OpenAPITools / OpenAPITools/openapi-generator

[BUG][Protobuf-Generator] generating arbitray protocol buffers - commit c96d3088c506f6af09b095e7b25828fce17985dc breaks existing protobuf users

Open
#21,299 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • What's the actual output vs expected output? In a protobuf file: fileName vs file_name
Description

in https://github.com/OpenAPITools/openapi-generator/commit/c96d3088c506f6af09b095e7b25828fce17985dc the protobuf generator switches the variable names inside the proto from camelCase to snake_case. While this is the correct way to deal with protobufs, it breaks existing projects.

It would be delightful if you provided an option to keep the old behavior to not break systems that already use the protobuf-generator.

openapi-generator version

7.13.0, it is a regression for existing projects that have been using < 7.13.0

OpenAPI declaration file content or url
Generation Details
Steps to reproduce

Watch the diff of a proto file generated from 7.12 and 7.13 - the content has been changed.

Related issues/PRs
Suggest a fix

In modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java, I think around line 518 I think we would need to check with an if statement if someone provided a command line switch to use the old behavior.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ProtobufSchemaCodegen.java around line 518, and compare the generated proto output from versions 7.12 and 7.13. Determine how a command-line switch should select the previous naming behavior, then verify that enabled and default generation produce the expected variable names.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.