Hyral
Hyral copied to clipboard
Add JSON schema support for validation and relationships decoration
- Define a superset for JSON schema which adds cardinality support in #ref tags.
- Create a factory method to create the relationship decorator from a JSON schema
- Add Resource decorator for validating data when setting the data property.
Create this as a separate package. The package should introduce a helper method that accepts a JSON schema and initializes the relationship and validator decorators on the Resource.
As a JSON schema is a description of a single resource adding support via the repository seems logical.
Relationships:
- Somehow add the ability to register a JSON schema on repository level (use a decorator that adds this feature)
- Then add a Resource decorator to read the relationships from JSON schema you can get via the repository manager
Validation:
- Find a good validation library and add a decorator that validates the data on setting the data property.