-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Generate JSON schemas from Python data models [TECHART-244] #8
Draft
Olaf-Wolf3D
wants to merge
66
commits into
main
Choose a base branch
from
feature/python-data-model
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,673
−32
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add $schema and $id fields to json, remove property titles
update pre-commit hooks, setup guide, merge dev envs and set local path
json schema and Python errors share messages
so they can be re-used independently by other models
so it does not need to be disabled in each model
share error message between python and json schema by use of format()
use enum values to create model field types
should increase reusability of functions
Co-authored-by: Olaf Haag <[email protected]> Co-authored-by: IvanRPM <[email protected]>
a pydantic model that asserts that there are no animations Closes SRV-531
can write json schema to a default location using the caller's file name
use the new function instead of the logger to output schema to json Task: SRV-531
use caller's name only as a backup
move GenerateAnimationJsonSchema to basemodel as SchemaNoTitleAndDefault
comment for a json schema to avoid confusion between object and keyword
populate models with the value of enums, rather than the raw enum
Move create_enum_class to separate module for re-use
dynamic enums instead of Literals, new model names, error messages Closes SRV-528
instead of str use object as types to allow anything Closes SRV-483
inject values from the ErrorDetails into a custom template message co-authored by: @TechyDaniel
reusable field definitions
move extra functions and classes related to json schemas to schema_io
use moved functions that were moved earlier
errror messages, fields
Python <3.11 doesn't yet support it in the stdlib
it was blocking passing str to enum fields
remove plural from name fix error messages make wrap validators not override base refactor for latest changes json schema generation fixed Task: SRV-528
need to change after common_texture renaming Task: SRV-483
probably introduced through mypy update
Remove $id and $schema from subschemas
when not using hatch, the pre-commit install command needs to be more
make code blocks copyable in github UI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a proof of concept to generate the JSON schemas for asset validation from Python data models using pydantic.
Its goal is to have 1 source of truth that can be either used directly in Python or be exported to JSON schemas for consumption by other services.
It should theoretically even be possible to read compatible json instances generated by other services and validate them against the Python data model.
Checklist: