Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support date only type #89

Open
tractorcow opened this issue Mar 10, 2025 · 1 comment · May be fixed by #90
Open

Support date only type #89

tractorcow opened this issue Mar 10, 2025 · 1 comment · May be fixed by #90

Comments

@tractorcow
Copy link

Is your feature request related to a problem? Please describe.

When I am creating fields with type string, and format "date" I would like them to be typed as python datetime.date

"birth_date": {
	"type": "string",
	"format": "date"
},			

Describe the solution you'd like

Logic in type_converter when, with orjson enabled, types are generated as "datetime.date".

Describe alternatives you've considered

Potentially some other hooks or injectable logic inside type_converter that could allow a developer to inject or otherwise override type generation. This could be some kind of type registry.

Additional context
I am generating schema for date types that do not have time component, and would be incorrect to use datetime type.

@tractorcow
Copy link
Author

Alternatively, if a type is generated as "type": "string", and some unknown "format", it should at least type as a string rather than erroring.

    raise TypeError(f"Unknown type: {schema.type}")
TypeError: Unknown type: DataType.STRING
make: *** [makefile:11: generate-sdk] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant