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

required based on field condition #169

Closed
whyvez opened this issue Mar 11, 2015 · 3 comments
Closed

required based on field condition #169

whyvez opened this issue Mar 11, 2015 · 3 comments

Comments

@whyvez
Copy link

whyvez commented Mar 11, 2015

I am running into some cases where required is based on some field conditions. I started using the example below as a strategy.

example:

{
  "name": "sapling_plot_shape",
  "type": "string",
  "constraints": {
    "pattern": "/^(C|R|S)$/"
  }
},
{
  "name": "sapling_tagging_limit_dbh",
  "type": "number",
  "constraints": {
    "required": "sapling_plot_area > 0",
    "minimum": 0.1,
    "maximum": 12.0
  }
},
{
  "name": "sapling_tagging_limit_height",
  "type": "number",
  "constraints": {
    "required": "sapling_plot_area > 0",
    "minimum": 1.3,
    "maximum": 20.0
  }
}
@rufuspollock
Copy link
Contributor

WONTFIX.

So I think this is a really nice example of extending the spec but I don't think it will go in "officially" for the present given that there is a lot of complexity and need may be limited. So: please keep doing this and inform us how the pattern works out - we just won't make it official and require tool implementors to support.

My one suggestion at the moment is to maybe re name "required" where it is conditional to "requiredComplex" or something so you don't end up over-writing the official required field.

@loco-philippe
Copy link
Contributor

To respond to Peter's comment in camtrap-dp#32, I can formalize a new recipe (e.g. relationships) based on the solution detailed in the notebook shared in #859.

Do you agree with this proposal?

@roll : If yes, should this be formalized by a pattern modification (by a PR) ?

@roll
Copy link
Member

roll commented Apr 9, 2024

cc @peterdesmet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants