-
Notifications
You must be signed in to change notification settings - Fork 12
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
Validate class object with jsonschema #61
Comments
@jugaadi I'm (obviously) not the owner of this project, but I'm confused about what you are asking. What do you mean by "class object validation"? JSON Schema works on its own JSON-derived data model which doesn't have a concept of class as in OO programming. jschon's JSON class does a lot of important work, particularly by enabling upward traversals, and removing it would require a drastic re-architecting of the package. |
Yes.. I was wondering whether how I can use JSON Schema to define constraints for dataclass/pydantic class object.
Completely agree. I wanted to know how to make a dataclass/pydantic equivalent of the jschon JSON class. |
@jugaadi oh, I see. My Python knowledge is a little dated and I had not been aware of the So when you say "maintain a protocol" you mean some sort of interface that both Are you trying to both generate a schema from a dataclass (as Pydantic does) and treate dataclass instances as schema instances for validatin/annotation purposes? |
@handrews Thanks for your inputs.
dataclass/pydantic is just an example. It can be a regular class instance too.
Yes. Some form of extensibility would help a lot.
We're basically marshalling the pydantic/dataclass/regular object into another schema-defined json. Therefore, the source schema doesnt matter much. |
Will it be a good idea to pursue class object validation with jsonschema? Can we maintain a protocol instead of the current JSON class ?
The text was updated successfully, but these errors were encountered: