{"record":{"id":"684fd04154d4b272","repo":"grpc-ecosystem/grpc-gateway","slug":"extension-keys-need-to-start-with-x-q","errorCode":null,"errorMessage":"extension keys need to start with \"x-\": %q","messagePattern":"extension keys need to start with \"x-\": %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-openapiv2/internal/genopenapi/template.go","lineNumber":2683,"sourceCode":"\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmatched = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !matched {\n\t\t\texistingTags = append(existingTags, tag)\n\t\t}\n\t}\n\treturn existingTags\n}\n\nfunc processExtensions(inputExts map[string]*structpb.Value) ([]extension, error) {\n\texts := make([]extension, 0, len(inputExts))\n\tfor k, v := range inputExts {\n\t\tif !strings.HasPrefix(k, \"x-\") {\n\t\t\treturn nil, fmt.Errorf(\"extension keys need to start with \\\"x-\\\": %q\", k)\n\t\t}\n\t\text, err := (&protojson.MarshalOptions{Indent: \"  \"}).Marshal(v)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\texts = append(exts, extension{key: k, value: ext})\n\t}\n\tsort.Slice(exts, func(i, j int) bool { return exts[i].key < exts[j].key })\n\treturn exts, nil\n}\n\nfunc validateHeaderTypeAndFormat(headerType, format string) error {\n\t// The type of the object. The value MUST be one of \"string\", \"number\", \"integer\", \"boolean\", or \"array\"\n\t// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject\n\t// Note: currently not implementing array as we are only implementing this in the operation response context\n\tswitch headerType {\n\t// the format property is an open string-valued property, and can have any value to support documentation needs\n\t// primary check for format is to ensure that the number/integer formats are extensions of the specified type","sourceCodeStart":2665,"sourceCodeEnd":2701,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-openapiv2/internal/genopenapi/template.go#L2665-L2701","documentation":"Spec-validation error from processExtensions: an extension key in the openapiv2 options does not begin with the OpenAPI-mandated 'x-' prefix, which would produce a non-conformant vendor extension. The offending input is the extension map key reported in the message.","triggerScenarios":"Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:2683 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rename the extension key to start with \"x-\" (e.g. x-amazon-apigateway-integration).","Move non-extension data out of the extensions map."],"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"}