{"record":{"id":"604bde7972dc130e","repo":"grpc-ecosystem/grpc-gateway","slug":"at-least-one-input-is-required","errorCode":null,"errorMessage":"at least one input is required","messagePattern":"at least one input is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"openapiv3-merge/internal/merge/merge.go","lineNumber":55,"sourceCode":")\n\n// Input is a single OpenAPI 3.1 JSON document to merge.\ntype Input struct {\n\t// Name identifies the document in error messages, typically the path\n\t// the document was loaded from.\n\tName string\n\t// Data is the raw JSON content of the document.\n\tData []byte\n}\n\n// Merge combines inputs into a single OpenAPI 3.1 JSON document and returns\n// its pretty-printed bytes (two-space indent, matching protoc-gen-openapiv3).\n//\n// At least one input is required. The first input's `info`, `servers`, and\n// `externalDocs` are kept in the merged document.\nfunc Merge(inputs []Input) ([]byte, error) {\n\tif len(inputs) == 0 {\n\t\treturn nil, errors.New(\"at least one input is required\")\n\t}\n\tdocs := make([]*document, len(inputs))\n\tfor i, in := range inputs {\n\t\td, err := parse(in)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdocs[i] = d\n\t}\n\tmerged, err := mergeAll(docs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Drop empty container fields so encoding/json's omitempty omits them.\n\tif merged.Paths.len() == 0 {\n\t\tmerged.Paths = nil\n\t}\n\tif merged.Webhooks.len() == 0 {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/openapiv3-merge/internal/merge/merge.go#L37-L73","documentation":"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.","triggerScenarios":"Thrown at openapiv3-merge/internal/merge/merge.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass at least one Input to Merge.","In the CLI, provide at least one FILE argument so run() builds a non-empty inputs slice."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}