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

[jts] Add constraints.oneOf #175

Closed
pwalsh opened this issue Apr 8, 2015 · 3 comments
Closed

[jts] Add constraints.oneOf #175

pwalsh opened this issue Apr 8, 2015 · 3 comments

Comments

@pwalsh
Copy link
Member

@pwalsh pwalsh commented Apr 8, 2015

constraints.oneOf

where oneOf would be an array of values, each of the same type/format of the field.

Example

{
    "name": "field_name"
    "constraints": {
        "oneOf": ["this", "that", "other"]
    }
}

Here is an example in a schema that I'm experimenting with.

Implementation

Implementors of the spec would ensure that:

  • Each item in the oneOf array is of the same type/format as the field declares for its values
  • That the value of the field is in the oneOf array

References

JSON Schema has enum (example) and oneOf (example)

What I called oneOf above is probably more like an enum in JSON Schema. I prefer the oneOf terminology here as it fits with the more descriptive, human-oriented nature of the JTS spec, but, I'm easy.

@rufuspollock
Copy link
Contributor

@rufuspollock rufuspollock commented Apr 8, 2015

I would move for immediate inclusion as seems a small and very sensible addition.

@paulfitz any thoughts?

@pwalsh are you happy to submit a PR?

@pwalsh
Copy link
Member Author

@pwalsh pwalsh commented Apr 8, 2015

Yes, will do pull request.

@paulfitz
Copy link
Contributor

@paulfitz paulfitz commented Apr 12, 2015

this is a very common case, good to have a way to express it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants