danielgtaylor / danielgtaylor/python-betterproto

PascalCase support

Offen
#89 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug high priority medium
Vorherrschende Sprache
Python
Sterne
1.8k
Forks
234
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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"}
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.