Skip to content

Extend given to check against the value #1395

@danieldraper

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

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