Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Add "requires" parameter validation #46

Open
blakeembrey opened this issue Jun 26, 2014 · 3 comments
Open

Add "requires" parameter validation #46

blakeembrey opened this issue Jun 26, 2014 · 3 comments

Comments

@blakeembrey
Copy link
Contributor

Adding an new "requires" validation parameter could be useful when validation queries. I would like to suggest the syntax requires: path for specifying that a parameter requires another for use. For example:

queryParameters:
  lat:
    type: string
    requires: lng
  lng:
    type: string
    requires: lat
@dmartinezg
Copy link

The initial drafts had these, requires should be a list.

BUT, If we add it, then we need to add conflicts to indicate that this parameter cannot be used with others.

And then, you will want to say, required only if parameterA == 'valuea' and not if parameterB == 'valueB'.

We call this feature, by the general theme: dependencies and we do not have a clear answer for it yet.

@Philzen
Copy link
Contributor

Philzen commented Jul 4, 2014

+1 reg. adding a conflicts property , see #38

At least i'm looking for a way to avoid having statements like "don't use with parameter xy..." in a description. For the example of Oauth2, maybe a smart conflicts property could capture conflicts when a certain named parameter is set to a specific value, i.e. conflicts: { namedParameter: "conflictsIfNamedParameterHasThisValue"}

@Philzen
Copy link
Contributor

Philzen commented Aug 9, 2014

@blakeembrey Regarding the lat/lon example - there's a simple alternative to it, namely requiring a combined parameter. I've see that in the google elevation api (?locations=64.330000,7.500000), and in the api i'm currently building we simply refer to the geouri formatting rules defined in RFC5870 - which is effectively the same plus optional altitude and uncertainty values.

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

No branches or pull requests

4 participants