{"record":{"id":"3f818392489680a1","repo":"grpc-ecosystem/grpc-gateway","slug":"unsupported-type-q","errorCode":null,"errorMessage":"unsupported type: %q","messagePattern":"unsupported type: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-openapiv2/internal/genopenapi/template.go","lineNumber":480,"sourceCode":"\tfor _, nestedField := range msg.Fields {\n\t\tif !isVisible(getFieldVisibilityOption(nestedField), reg) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName := reg.FieldName(field)\n\t\tp, err := nestedQueryParams(msg, nestedField, prefix+fieldName+\".\", reg, pathParams, body, touchedOut)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams = append(params, p...)\n\t}\n\treturn params, nil\n}\n\nfunc getMapParamKey(t descriptorpb.FieldDescriptorProto_Type) (string, error) {\n\ttType, f, ok := primitiveSchema(t)\n\tif !ok || f == \"byte\" || f == \"float\" || f == \"double\" {\n\t\treturn \"\", fmt.Errorf(\"unsupported type: %q\", f)\n\t}\n\treturn tType, nil\n}\n\n// findServicesMessagesAndEnumerations discovers all messages and enums defined in the RPC methods of the service.\nfunc findServicesMessagesAndEnumerations(s []*descriptor.Service, reg *descriptor.Registry, m messageMap, ms messageMap, e enumMap, refs refMap) {\n\tfor _, svc := range s {\n\t\tif !isVisible(getServiceVisibilityOption(svc), reg) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, meth := range svc.Methods {\n\t\t\t// Request may be fully included in query\n\t\t\t{\n\t\t\t\tif !isVisible(getMethodVisibilityOption(meth), reg) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-openapiv2/internal/genopenapi/template.go#L462-L498","documentation":"getMapParamKey derives the OpenAPI parameter key type for map-typed query fields. OpenAPI query parameter map keys must be simple string-renderable primitive types; if the key field's type is not a supported primitive (or is byte/float/double), the generator refuses with 'unsupported type: %q'. Protobuf allows int32/bool etc. as map keys, but this generator can't express such keys as flat query parameters.","triggerScenarios":"nestedQueryParams encounters a map field whose key type t, passed through primitiveSchema, is either not a primitive (ok=false) or maps to byte, float, or double — i.e. a map<k,v> in a query parameter path with an unsupported key type k.","commonSituations":"Protos using map<int64, string> or map<bool, ...> in GET request messages rendered as query parameters; maps keyed by bytes; legacy protos with unusual key choices surfaced when first generating OpenAPI docs.","solutions":["Change the map key type to string (or a supported integral type) in the proto used for query parameters.","Move the map out of the query request into a body-based (POST) request.","Replace the map with repeated message entries (e.g. repeated Pair { string key; string value; }) which the generator can render.","If the key must remain non-string, exclude that field from query rendering by restructuring the request message."],"exampleFix":"// before\nmessage GetRequest { map<int64, string> attrs = 1; }\n\n// after\nmessage GetRequest { map<string, string> attrs = 1; }","handlingStrategy":"validation","validationCode":"// Pre-check map key types in query request protos:\nif keyType == \"bytes\" || keyType == \"float\" || keyType == \"double\" {\n    return fmt.Errorf(\"map key type %s unsupported for query params; use string\", keyType)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Convention: always use string keys for maps in GET request messages.","Prefer repeated key/value message pairs over exotic map key types.","Document the constraint in proto style guide for the team."],"tags":["codegen","openapi","map-keys","query-parameters"],"backgroundTag":"unsupported-map-key-type","analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}