grpc-ecosystem/grpc-gateway · error
unknown field type %v
Error message
unknown field type %v
What it means
Type-mapping error in genopenapi renderServices: a path parameter's target field type (pt) has no mapping in primitiveSchema, so the generator cannot determine the OpenAPI paramType/paramFormat. The failing input is an unusual proto field kind (e.g. group or unmapped WKT) used as a path parameter.
Source
Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:1662
paramFormat = ""
enumNames = listEnumNames(reg, enum)
if reg.GetEnumsAsInts() {
paramType = "integer"
paramFormat = ""
enumNames = listEnumNumbers(reg, enum)
}
schema := schemaOfField(parameter.Target, reg, customRefs)
desc = schema.Description
defaultValue = schema.Default
example = schema.Example
schemaPattern = schema.Pattern
extensions = schema.extensions
default:
var ok bool
paramType, paramFormat, ok = primitiveSchema(pt)
if !ok {
return fmt.Errorf("unknown field type %v", pt)
}
schema := schemaOfField(parameter.Target, reg, customRefs)
desc = schema.Description
defaultValue = schema.Default
example = schema.Example
schemaPattern = schema.Pattern
extensions = schema.extensions
// If there is no mandatory format based on the field,
// allow it to be overridden by the user
if paramFormat == "" {
paramFormat = schema.Format
}
}
if parameter.IsRepeated() {
core := schemaCore{Type: paramType, Format: paramFormat}
if parameter.IsEnum() {View on GitHub (pinned to a58a4436a3)
Solutions
- Use a primitive or supported enum/message type for the path parameter.
- Add/update type mappings or upgrade grpc-gateway for wider type support.
- Move the value into the body/query where richer schema rendering applies.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at protoc-gen-openapiv2/internal/genopenapi/template.go:1662 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/5cd70b45dbf74a40.
Report an issue: GitHub.