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.
Pydantic does not (yet) implement
dependentRequiredwhen generating a JSON schema.Per our requirements, if a notification has a value for the
CTAfield, then an accompanyingURLmust 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 thatURLexists ifCTAexists). As long as JSON notifications are only generated byNotificationSchema.py, they should be valid.