danielgtaylor / danielgtaylor/python-betterproto

PascalCase support

Open
#89 2 comments 0 reactions 0 assignees View on GitHub
bug high priority medium
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

For a PascalCase field, betterproto uses the snake case in the class field, and can handle multiple cases in input json. However, it converts it to the camel case in output json, while protobuf requires a pascal case in the input. This makes the json incompatible.

For example,

```protobuf
message Test {
int32 camelCase = 1;
my_enum snake_case = 2;
snake_case_message snake_case_message = 3;
int32 PascalCase =4;
}
```

betterproto will output
```json
{"camelCase": 1, "pascalCase": 3, "snakeCase": "ONE"}
```
but protobuf is expecting
```json
{"PascalCase": 3, "camelCase": 1, "snakeCase": "ONE"}
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing betterproto's JSON serialization for the provided protobuf message and compare its handling of camelCase, snake_case, and PascalCase fields with the expected protobuf JSON names. Use the example in the issue as a regression case; done means output preserves PascalCase while retaining the other expected field names.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.