{"record":{"id":"d4d57a55a13599f7","repo":"grpc-ecosystem/grpc-gateway","slug":"no-description-nor-summary-property","errorCode":null,"errorMessage":"no description nor summary property","messagePattern":"no description nor summary property","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-openapiv2/internal/genopenapi/template.go","lineNumber":2980,"sourceCode":"\t\t\t\t// keep the comment precedence when updating the package definition\n\t\t\t\tif descriptionValue.Len() == 0 || isPackageObject {\n\t\t\t\t\tdescriptionValue.Set(reflect.ValueOf(description))\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// There was no summary field on the swaggerObject. Try to apply the\n\t// whole comment into description if the OpenAPI object description is empty.\n\tif descriptionValue.CanSet() {\n\t\tif descriptionValue.Len() == 0 || isPackageObject {\n\t\t\tdescriptionValue.Set(reflect.ValueOf(strings.Join(paragraphs, paragraphDeliminator)))\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"no description nor summary property\")\n}\n\nfunc fieldProtoComments(reg *descriptor.Registry, msg *descriptor.Message, field *descriptor.Field) string {\n\tprotoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.DescriptorProto)(nil)), \"Field\")\n\tfor i, f := range msg.Fields {\n\t\tif f == field {\n\t\t\treturn protoComments(reg, msg.File, msg.Outers, \"MessageType\", int32(msg.Index), protoPath, int32(i))\n\t\t}\n\t}\n\treturn \"\"\n}\n\nfunc enumValueProtoComments(reg *descriptor.Registry, enum *descriptor.Enum) string {\n\tprotoPath := protoPathIndex(reflect.TypeOf((*descriptorpb.EnumDescriptorProto)(nil)), \"Value\")\n\tvar comments []string\n\tfor idx, value := range enum.GetValue() {\n\t\tif reg.GetOmitEnumDefaultValue() && value.GetNumber() == 0 {\n\t\t\tcontinue","sourceCodeStart":2962,"sourceCodeEnd":2998,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-openapiv2/internal/genopenapi/template.go#L2962-L2998","documentation":"This error ends the same comment-attachment helper in template.go: if the target object has neither a settable Summary nor a settable Description property, the helper cannot attach proto comments anywhere and returns \"no description nor summary property\". It occurs when the function falls through both branches — no summary was settable and no description was settable/available — during OpenAPI template rendering.","triggerScenarios":"During applyTemplate when fieldProtoComments/object comment attachment runs against a reflect.Value that lacks both Summary and Description settable fields — e.g. annotating a custom or unexpected object type in the OpenAPI tree.","commonSituations":"Custom extensions or plugin hookouts producing object types not matching the expected OpenAPI structs; mismatched vendored copies of go-openapi/spec types; generating comments for objects the generator does not know how to annotate.","solutions":["Verify you are using the standard grpc-gateway OpenAPI object types (or compatible go-openapi/spec types) that expose Summary and Description fields.","Remove custom schema/object overrides that omit Summary/Description from the annotated type.","Align vendored go-openapi/spec version with what grpc-gateway expects (go mod tidy / update vendor).","Upgrade protoc-gen-openapiv2 to the latest version to pick up fixes in comment attachment."],"exampleFix":"// before\ntype customObj struct { Foo string }\n// after\ntype customObj struct {\n    Summary     string\n    Description string\n}","handlingStrategy":"type-guard","validationCode":"v := reflect.ValueOf(obj).Elem()\nif !(fieldByNameSettable(v, \"Summary\") || fieldByNameSettable(v, \"Description\")) {\n    return fmt.Errorf(\"object %T must expose Summary or Description\", obj)\n}","typeGuard":"func annotatable(obj interface{}) bool {\n    v := reflect.ValueOf(obj)\n    if v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct { return false }\n    s, d := v.Elem().FieldByName(\"Summary\"), v.Elem().FieldByName(\"Description\")\n    return (s.IsValid() && s.CanSet()) || (d.IsValid() && d.CanSet())\n}","tryCatchPattern":"if err := applyTemplate(...); err != nil {\n    if strings.Contains(err.Error(), \"no description nor summary\") {\n        return fmt.Errorf(\"unexpected object type in OpenAPI tree: %w\", err)\n    }\n    return err\n}","preventionTips":["Avoid swapping in alternative spec libraries; keep go-openapi/spec versions in sync.","Run go mod tidy to remove stale vendored copies of spec types.","Upgrade protoc-gen-openapiv2 regularly to benefit from comment-attachment fixes."],"tags":["openapi","reflection","code-generation","proto-comments"],"backgroundTag":"reflection-field-not-settable","analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}