grpc-ecosystem/grpc-gateway · error

tag entry missing required "name"

Error message

tag entry missing required "name"

What it means

Spec-compliance error from tagName: a tag object in the merged document's OpenAPI tags array has no non-empty "name" field, which the OpenAPI spec requires. The merge rejects the input rather than emitting an invalid nameless tag.

Source

Thrown at openapiv3-merge/internal/merge/merge.go:475

	dec := json.NewDecoder(bytes.NewReader(raw))
	dec.UseNumber()
	if err := dec.Decode(&v); err != nil {
		return nil, err
	}
	return json.Marshal(v)
}

// tagName extracts the `name` field from a tag entry. Tag entries without
// a name violate the OpenAPI spec and are rejected.
func tagName(raw json.RawMessage) (string, error) {
	var t struct {
		Name string `json:"name"`
	}
	if err := json.Unmarshal(raw, &t); err != nil {
		return "", fmt.Errorf("invalid tag entry: %w", err)
	}
	if t.Name == "" {
		return "", errors.New("tag entry missing required \"name\"")
	}
	return t.Name, nil
}

// isJSONNull reports whether raw is the JSON null literal (possibly
// surrounded by whitespace). Empty input also counts as null.
func isJSONNull(raw json.RawMessage) bool {
	if len(raw) == 0 {
		return true
	}
	return bytes.Equal(bytes.TrimSpace(raw), []byte("null"))
}

// orderedObject is an insertion-ordered JSON object. It is used for
// `paths`, `webhooks`, and the bucket of unrecognised top-level keys —
// the three places where input-file order matters and encoding/json's
// alphabetical key sort would lose information.
type orderedObject struct {

View on GitHub (pinned to a58a4436a3)

Solutions

  1. Add a non-empty "name" to the tag entry in the source OpenAPI document.
  2. Remove the nameless tag entry if it is unneeded.
  3. Ensure the generating plugin always emits tag objects with names.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at openapiv3-merge/internal/merge/merge.go:475 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02). Data as JSON: /api/errors/0e8d81b497cca1c6. Report an issue: GitHub.