glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL

Home Page:https://app.quicktype.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature request][Python] CLI arg for keeping leading underscore for field names.

balazser opened this issue · comments

I noticed quicktype cleans up the leading underscores in the field names that are parsed by --no-just-types init but not by --just-types.

rallyAPIMajor = int(from_str(obj.get("_rallyAPIMajor")))

I use quicktype to generate TypedDict typehints for API calls with JSON responses using the following command.
quicktype -l python --no-nice-property-names --just-types --top-level Response then removing the __init__ constructor and inheriting from class Response(TypedDict).

Without leading underscores, the type schema is not representing the actual response schema. Could we add a CLI arg to keep the leading underscore? 🙏