Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9646
Closed
Open
Issue created Jun 02, 2021 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[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
  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

Assignee
Assign to
Time tracking