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

Validate params only if another param is present #1047

Merged
merged 1 commit into from
Jun 29, 2015

Commits on Jun 26, 2015

  1. Adds #given to DSL::Parameters, allowing for dependent params.

    Usage:
    
        # ...
        params do
          optional :shelf_id, type: Integer
          given :shelf_id do
            requires :bin_id, type: Integer
          end
        end
    
    This implements ruby-grape#958. In order to achieve the DSL-style implementation,
    I introduced the concept of a "lateral scope" as opposed to the
    "nested scope" which `requires :foo do` opens up. A lateral scope is
    subordinate to its parent, but not nested under an element.
    rnubel authored and Robert Nubel committed Jun 26, 2015
    Configuration menu
    Copy the full SHA
    2a541d5 View commit details
    Browse the repository at this point in the history