Skip to content

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

Description

@radishmouse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions