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.
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.
Pydantic does not (yet) implement
dependentRequired
when generating a JSON schema. Per our requirements, if a notification has a value for theCTA
field, then an accompanyingURL
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 thatURL
exists ifCTA
exists). As long as JSON notifications are only generated byNotificationSchema.py
, they should be valid.