jsonschema-gentypes
jsonschema-gentypes copied to clipboard
Preserving case when generating $ref classes
Using Python 3.10.12 and version jsonschema-gentypes
2.4.0
So for this schema:
{
"$schema": "http://json-schema.org/draft-06/schema#",
"definitions": {
"SubresourceUris": {
"type": "object",
"properties": {
"feedback": {
"type": "string"
}
},
"required": ["feedback"],
"title": "SubresourceUris"
}
},
"type": "object",
"properties": {
"subresource_uris": {
"$ref": "#/definitions/SubresourceUris"
}
},
"required": [
"subresource_uris"
],
"title": "ResponseType"
}
when I run:
from jsonschema_gentypes.cli import process_config
config = {
"python_version": None,
"generate": [
{
"source": "./input.json",
"destination": "./output.py",
}
],
}
process_config(config) # type: ignore
I get back the following:
from typing import TypedDict
from typing_extensions import Required
class Responsetype(TypedDict, total=False):
""" ResponseType. """
subresource_uris: Required["Subresourceuris"]
"""
SubresourceUris.
Required property
"""
class Subresourceuris(TypedDict, total=False):
""" SubresourceUris. """
feedback: Required[str]
""" Required property """
Is there any way to have the output match the case of the input, and have the class be named SubresourceUris
instead?
Love the library by the way! It's very nice.