Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: honor json_name option #1825

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Oct 12, 2022

  1. Configuration menu
    Copy the full SHA
    e72a709 View commit details
    Browse the repository at this point in the history
  2. Honor the json_name option. This is useful when a .proto file is comp…

    …iled for multiple languages, to conform to whatever random casing rules were chosen for the project:
    
    - The .proto convention is to use lower_snake_case for field names, and UPPER_SNAKE_CASE for enum names
    - C++ (via protoc) simply uses lower_snake_case for field names
    - C# (via protobuf-net) uses PascalCase for both field and enum names, and has options for customizing the names: https://github.com/protobuf-net/protobuf-net/blob/main/src/Tools/protogen.proto
    - JavaScript (via protobuf.js) uses camelCase for field names, and the json_name attribute can now be used to customize the name
    Example:
    message NetworkAdapter {
      string get_ip_address = 1 [json_name = "getIPAddress", (.protobuf_net.fieldopt).name ="GetIPAddress"];
    }
    Default names without the options:
    - C++: get_ip_address (unchanged)
    - C#: GetIpAddress
    - JS: getIpAddress
    Michael Green committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    996a09e View commit details
    Browse the repository at this point in the history
  3. Test for json_name option

    Michael Green committed Oct 12, 2022
    Configuration menu
    Copy the full SHA
    c0b68ac View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2023

  1. Configuration menu
    Copy the full SHA
    e5fa6b0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8777b33 View commit details
    Browse the repository at this point in the history