Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Frictionless pattern to support conditional constraints #32

Open
niconoe opened this issue Mar 11, 2021 · 1 comment
Open

Create Frictionless pattern to support conditional constraints #32

niconoe opened this issue Mar 11, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@niconoe
Copy link
Contributor

niconoe commented Mar 11, 2021

In GitLab by @peterdesmet on Sep 25, 2020, 14:25

Conditional constraints are not supported by Table Schema (see frictionlessdata/datapackage#169).

So to support:

scientific_name = required if observation_type = "animal"

We would have to extend the schema as suggested in https://stackoverflow.com/a/38781027/2463806, i.e. (if I interpret this correctly) adding the following at the end of observations-table-schema.json:

"anyOf": [
  {
    "properties": {
       "observation_type": { "const": "animal" }
    },
    "required": ["scientific_name"]
  }
]

Or (using the JSON Schema (draft-07)):

"if": {
  "properties": {
    "observation_type": { "const": "animal" }
  },
  "required": ["observation_type"]
},
"then": { "required": ["scientific_name"] }

But in my understanding, it wouldn't be picked up by any of the Table Schema validators, so it's probably not worth adding and just leave scientific_name not required.

@niconoe niconoe closed this as completed Mar 11, 2021
@peterdesmet peterdesmet changed the title Figure out how to define conditional requirements [REPLACEMENT ISSUE] Figure out how to define conditional requirements Mar 11, 2021
@tdwg tdwg deleted a comment from niconoe May 25, 2023
@tdwg tdwg deleted a comment from niconoe May 25, 2023
@tdwg tdwg deleted a comment from niconoe May 25, 2023
@tdwg tdwg deleted a comment from niconoe May 25, 2023
@tdwg tdwg deleted a comment from niconoe May 25, 2023
@peterdesmet
Copy link
Member

Another option would be to suggest conditional constraints as a new pattern to Frictionless. We would then have to define how conditional constrains should be specified (the syntax) and have tools such as Frictionless Framework implement it.

@peterdesmet peterdesmet reopened this May 25, 2023
@peterdesmet peterdesmet added enhancement New feature or request and removed todo community:consensus labels May 25, 2023
@peterdesmet peterdesmet changed the title Figure out how to define conditional requirements Create Frictionless pattern to support conditional constraints May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants