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

JSON Schema generated by pydantic model does not include dependentRequired constraint #7

Open
radishmouse opened this issue Jun 7, 2024 · 0 comments

Comments

@radishmouse
Copy link
Contributor

Pydantic does not (yet) implement dependentRequired when generating a JSON schema.
Per our requirements, if a notification has a value for the CTA field, then an accompanying URL must also be defined.

A workaround is to create a custom schema generator, but it may not be worth the effort.

Our pydantic model (NotificationSchema.py) already enforces the constraint (checking that URL exists if CTA exists). As long as JSON notifications are only generated by NotificationSchema.py, they should be valid.

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

No branches or pull requests

1 participant