Skip to content

fromJSON should accept both snake_case and camelCase keys #1012

@jdbp-classpass

Description

@jdbp-classpass

The proto3 JSON specification says that Proto3 JSON parsers are required to accept both the converted lowerCamelCase name and the proto field name.. This seems to mean that, given a message with a field like "my_field", the fromJson method should accept either {"my_field": "value"} or {"myField": "value"}. Google's standard protobuf Java library works this way.

Currently the ts-proto generated fromJSON only accepts one or the other, as determined by the snakeToCamel option. Ideally snakeToCamel would only affect toJSON (which is how the spec describes it), but fromJSON would accept either one regardless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions