OpenAPI Generation Issue: Empty Specification for Protocol Buffer Service
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start at the protoc-gen-openapi plugin entry point and reproduce the command with the supplied petstore.proto. Compare the generated openapi.yaml with the service, request, and response definitions; done means the output contains the expected paths and schemas instead of empty objects.
Written by the indexing model from the issue text.
Description
Issue Summary:
I am experiencing a problem with the Gnostic library and the protoc-gen-openapi plugin when generating an OpenAPI specification from a Protocol Buffer service. The generated OpenAPI specification is empty and does not reflect the contents of the Protocol Buffer service definition.
Steps to Reproduce:
- Create a Protocol Buffer service definition, like the one in Attachment 1.
- Use the following command to generate the OpenAPI specification:
protoc petstore.proto -I=. --openapi_out=. - Examine the generated OpenAPI YAML specification (Attachment 2), which is expected to describe the Protocol Buffer service.
Expected Behavior:
The generated OpenAPI specification should accurately represent the Protocol Buffer service and its endpoints, including any request and response message types.
Actual Behavior:
The generated OpenAPI specification is empty, with no paths, components, or schemas, and it does not reflect the structure of the Protocol Buffer service.
Attachments:
- Input Protobuf service (petstore.proto)
syntax = "proto3";
package swaggerpetstore_openapi3_1;
option go_package = "swaggerpetstore/openapi3_1";
message GetPetByIdRequest {
// ID of pet to return
int64 petId = 1;
}
message Pet {
int64 id = 1;
string name = 2;
Category category = 3;
repeated string photoUrls = 4;
repeated Tag tags = 5;
string status = 6;
message Category {
int64 id = 1;
string name = 2;
}
message Tag {
int64 id = 1;
string name = 2;
}
}
service SwaggerPetstoreOpenAPI31Service {
// Find pet by ID
//
// Returns a single pet
rpc GetPetById(GetPetByIdRequest) returns (Pet) {}
}
- Output OpenAPI definition (openapi.yaml)
# Generated with protoc-gen-openapi
# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi
openapi: 3.0.3
info:
title: ""
version: 0.0.1
paths: {}
components:
schemas: {}
Additional Information:
Go Version: go1.21.4 windows/amd64
Gnostic Library Version: installed with go install github.com/google/gnostic@latest so I guess v0.7.0 (?)
Protocol Buffer Compiler Version: libprotoc 25.0 (protoc-25.0-win64)
Operating System: Windows 11 Enterprise build 22631
- Dominant language
- Go
- Stars
- 2.3k
- Forks
- 279
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/gnostic
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100