thunderbird / thunderbird-notifications

In-App notifications for Thunderbird
Mozilla Public License 2.0
0 stars 1 forks source link

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

Open radishmouse opened 5 months ago

radishmouse commented 5 months ago

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.