Skip to content

[BUG][Protocol Buffer] Large Protocol Buffer Field Numbers #9646

@daniel-vera-g

Description

@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
  1. Get the Yaml spec above
  2. Run the generation command above
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions