[BUG][Protocol Buffer] Large Protocol Buffer Field Numbers
Created by: daniel-vera-g
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output?
Description
I want to use openapi-generator to generate Protocol Buffer definitions. The files are generated, but the field numbers in the models are very high. F.ex:
message User {
int64 id = 3355;
string username = 265713450;
string firstName = 132835675;
openapi-generator version
openapitools/openapi-generator-cli:latest
OpenAPI declaration file content or url
I used the petstore.yaml from this reository.
Generation Details
docker run --rm \
-v ${PWD}:/local openapitools/openapi-generator-cli:latest generate \
-i /local/petstore.yaml \
-g protobuf-schema \
-o /local/out
Steps to reproduce
- Get the Yaml spec above
- Run the generation command above
- See the generated Proto Files in
./out
Suggest a fix
I expect to have model field numbers starting from 1 onwards for messages. Taking the output from above, I expect:
message User {
int64 id = 1;
string username = 2;
string firstName = 3;
See: https://developers.google.com/protocol-buffers/docs/overview#assigning_field_numbers