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

Add support for semi required parameters #2024

Closed
raderio opened this issue Dec 2, 2016 · 3 comments
Closed

Add support for semi required parameters #2024

raderio opened this issue Dec 2, 2016 · 3 comments

Comments

@raderio
Copy link

raderio commented Dec 2, 2016

We have a dto

class AuthenticationDto {
    public String email;
    public String password;

    public String socialNetwork;
    public String accessToken;
}

And we have 2 ways to autheticate

POST /sessions
{"email": "[email protected]", "password":"12345678"}
POST /sessions
{"social_network": "facebok", "access_token":"qqqwwweeerrtt"}

At the moment all fields are optional, but this not reflect that, if email is provided then password is required.
Proposal is to make password semi-required, this will indicate that is required in context, something like

AuthenticationDto {
    email (string, optional),
    password (string, semi-required{email}),
    social_network (string, optional),
    access_token (string, semi-required{social_network})
}

Or even better Swagger can show 2 models

AuthenticationDto {
    email (string),
    password (string)
}
AuthenticationDto {
    social_network (string),
    access_token (string)
}
@webron
Copy link
Contributor

webron commented Dec 2, 2016

The spec itself doesn't allow interdependent requirements, so we can't really implement it. The next version of the spec should have some support for it, but until then it can't be done.

@webron webron closed this as completed Dec 2, 2016
@raderio
Copy link
Author

raderio commented Jun 10, 2017

Where can I find information about interdependent requirements,?

@raderio
Copy link
Author

raderio commented Jun 10, 2017

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

No branches or pull requests

2 participants