Skip to content

Add support for scoped parameters in extra_params #96

Closed
@jsmestad

Description

@jsmestad

Background

Testing for missing values on a PUT request, it would be nice to have the following supported via extra_params with a example_request.

put '/users' do
  parameter :first_name, 'Users first name', scope: :user
  parameter :last_name, 'Users last name', scope: :user

  example_request 'with attributes', user: { first_name: 'John' } do
    status.should == 200
  end

  example_request 'without set attributes' do
    status.should == 422
  end
end

Currently this function is not "additive" but instead it overrides the entire user key with a new value. I am not sure if you want to use a different DSL for doing this sort of operation (like allowing some form of lets inside example_request blocks or a different syntax for specifying additive versus overwriting parameters).

Let me know what approach you'd like, as I am eager to contribute back to this awesome project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions