Skip to content

Revert "[+] support integer64 as string option (#355)" - #431

Closed
ajorgensen wants to merge 1 commit into
google:mainfrom
ajorgensen:revert/integer64
Closed

Revert "[+] support integer64 as string option (#355)"#431
ajorgensen wants to merge 1 commit into
google:mainfrom
ajorgensen:revert/integer64

Conversation

@ajorgensen

@ajorgensen ajorgensen commented Mar 7, 2024

Copy link
Copy Markdown

ref: #355
closes: #411

This reverts commit c62333b.

The original change conflated generating an OpenAPI v3 spec file with the guidance for encoding protobuf messages as json objects. OpenAPI v3 explicitly allows for integer types of int64 (https://swagger.io/docs/specification/data-models/data-types/#numbers). The OpenAPI v3 spec generated by this tool will then usually be fed into language specific generators which will determine how they want to handle each of the types depending on the specific target language.

@ajorgensen
ajorgensen requested a review from a team as a code owner March 7, 2024 17:23
@google-cla

google-cla Bot commented Mar 7, 2024

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

This reverts commit c62333b.

The original change conflated the guidance for encoding protobuf
messages as json objects with generating an OpenAPI v3 spec file.
OpenAPI v3 explicitly allows for integer types of int64
(https://swagger.io/docs/specification/data-models/data-types/#numbers).
The OpenAPI v3 spec generated by this tool will then usually be fed into
language specific generators which will determine how they want to
handle each of the types depending on the specific target language.
@n0v1

n0v1 commented Mar 19, 2024

Copy link
Copy Markdown

I also think that the generated OpenAPI specification should match the types in the proto file as close as possible and should not be language-specific. So for proto type int64 I would expect {"type": "integer", "format": "int64"} as it was before instead of {"type": "string"}.

@suncle1993

Copy link
Copy Markdown

Is there any update in this bug?

@ajorgensen

Copy link
Copy Markdown
Author

It appears there is a v2 of the protoc-gen-openapi generator which fixes this issue. Perhaps this project is no longer maintained? I'm going to close this as there appears to be no traction on the issue and https://github.com/grpc-ecosystem/grpc-gateway/tree/main/protoc-gen-openapiv2 appears to work correctly.

@ajorgensen ajorgensen closed this Aug 4, 2025
cusher added a commit to CFHT/gnostic that referenced this pull request Aug 12, 2026
For the reasoning outlined in google#431 this
adds back in the ability to serialize 64-bit integer types as integer rather
than string.

However, recognizing that some users will be using this for APIs compatible
with proto JSON, this keeps both options in, controlled by a command-line flag.
cusher added a commit to CFHT/gnostic that referenced this pull request Aug 12, 2026
For the reasoning outlined in google#431 this
adds back in the ability to serialize 64-bit integer types as integer rather
than string.

However, recognizing that some users will be using this for APIs compatible
with proto JSON, this keeps both options in, controlled by a command-line flag.
cusher added a commit to CFHT/gnostic that referenced this pull request Aug 12, 2026
For the reasoning outlined in google#431 this
adds back in the ability to serialize 64-bit integer types as integer rather
than string.

However, recognizing that some users will be using this for APIs compatible
with proto JSON, this keeps both options in, controlled by a command-line flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

protoc-gen-openapi BUG

4 participants