Skip to content

Extend given to check against the value #1395

Description

@danieldraper

It would be nice to allow a value to be specified on a given so that different parameters could be included for example:

params do
  requires :grant_type, type: String, values: [:password, :refresh_token]
  requires :client_id, type: String

  given :grant_type, value: ->(*) { |attr| attr == :password } do
    requires :username, type: String
    requires :password, type: String
  end

  given :grant_type, value: ->(*) { |attr| attr == :refresh_token } do
    requires :refresh_token, type: String
  end
end

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions