-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated swagger.yaml is corrupted in openapiv2 v2.17.0+: Path item becomes string instead of object #3557
Comments
I think it can probably be fixed like this ↓. However, this will cause existing tests to fail. I suspect it's a bug in go-yaml v3. $ go test -v -run YAMLIndent ./protoc-gen-openapiv2/internal/genopenapi
=== RUN TestGeneratedYAMLIndent
2023/08/30 22:27:50 ERROR: no message found: Status
generator_test.go:251: failed to generate targets: failed to encode OpenAPI for exampleproto/v1/exampleproto.proto: yaml: line 8: did not find expected key
--- FAIL: TestGeneratedYAMLIndent (0.00s)
FAIL
FAIL github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi 0.219s
FAIL |
Can confirm we are experiencing this also. |
Thanks for reporting this issue. Please feel free to submit a PR with the proposed change and we can work out exactly what if any test changes will need to be made. Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug Report
Starting from version v2.17.0 of openapiv2, the generated swagger.yaml file is corrupted. Specifically, where the path item should be an object, it has become a string.
To Reproduce
Execute the following using openapiv2 v2.17.1:
protoc -I . --openapiv2_out ./gen \ --openapiv2_opt=output_format=yaml \ your/service/v1/your_service.proto
For this, let's assume your_service.proto is as follows:
Expected behavior
The file generated with openapiv2 v.2.6.2 is as follows:
Actual Behavior
The file generated with openapiv2 v2.17.1 is as follows. The path item corresponding to /api/echo has turned into a string.
Your Environment
Mac OS - Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered: