grpc-ecosystem/grpc-gateway · error

at least one input is required

Error message

at least one input is required

What it means

Argument-validation error at the top of Merge: the inputs slice is empty. Merge needs at least one OpenAPI 3.1 document to seed the merged output (first input's info/servers/externalDocs are kept); with zero inputs there is nothing to produce, so it refuses instead of emitting an empty document.

Solutions

  1. Pass at least one Input to Merge.
  2. In the CLI, provide at least one FILE argument so run() builds a non-empty inputs slice.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at openapiv3-merge/internal/merge/merge.go:55 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/604bde7972dc130e. Report an issue: GitHub.

Appendix: source

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

)

// Input is a single OpenAPI 3.1 JSON document to merge.
type Input struct {
	// Name identifies the document in error messages, typically the path
	// the document was loaded from.
	Name string
	// Data is the raw JSON content of the document.
	Data []byte
}

// Merge combines inputs into a single OpenAPI 3.1 JSON document and returns
// its pretty-printed bytes (two-space indent, matching protoc-gen-openapiv3).
//
// At least one input is required. The first input's `info`, `servers`, and
// `externalDocs` are kept in the merged document.
func Merge(inputs []Input) ([]byte, error) {
	if len(inputs) == 0 {
		return nil, errors.New("at least one input is required")
	}
	docs := make([]*document, len(inputs))
	for i, in := range inputs {
		d, err := parse(in)
		if err != nil {
			return nil, err
		}
		docs[i] = d
	}
	merged, err := mergeAll(docs)
	if err != nil {
		return nil, err
	}
	// Drop empty container fields so encoding/json's omitempty omits them.
	if merged.Paths.len() == 0 {
		merged.Paths = nil
	}
	if merged.Webhooks.len() == 0 {

View on GitHub (pinned to a58a4436a3)