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 an alternative to action aware required param #377

Merged
merged 1 commit into from
Aug 24, 2015

Conversation

mourad-ifeelgoods
Copy link
Contributor

Feature

In some use cases, we want a param to required depending of the action. we could use action aware params (see https://github.com/Apipie/apipie-rails#action-aware-params), but how to handle parameters optional on creation but required on update ?

A possible solution is to pass a list of actions for which to parameter is required (See examples below)

Make a param required for all actions

param :name, String, required true

Make a param required only for update action

param :name, String, required :update

Make a param required only for update and create actions

param :name, String, required [:update, :create ]

Note
Beware that the required param may still be overridden by action aware param if specified

@mtparet
Copy link
Contributor

mtparet commented Jun 29, 2015

👍

@iNecas
Copy link
Member

iNecas commented Aug 24, 2015

Nice, thanks! Sorry for the delay, I was a bit late with the PRs lately.

iNecas added a commit that referenced this pull request Aug 24, 2015
Add an alternative to action aware required param
@iNecas iNecas merged commit 4b9bbd3 into Apipie:master Aug 24, 2015
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

Successfully merging this pull request may close these issues.

3 participants