Skip to content

Conditional requirements #19

Description

@jegjessing

Hi, I have tried to add an "if", "then", "else" in my schema, to add conditional required fields but I cannot make it work :-(
Using the validator I get a validation error (as expected) if I use the following:
"required": [ "transactionIdentifier", "reasonCode", "meteringpointId", "contractEnd" ]

but if I change this to:
"required": [ "transactionIdentifier", "reasonCode", "meteringpointId" ], "if": {"properties": {"header": {"properties": {"messageType": {"const": "406"}}}}}, "then": {"required": ["contractEnd"]}, "else": {"required": ["contractEnd"]}
I would expect the same result, since I have the same resulting "required" no matter what the condition..
But no, the field is not required...

So my question is, since "if" cases are not included in your Data folder. It is not implemented?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions