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

Unable to submit multiple params #128

Open
antarr opened this issue Dec 5, 2019 · 0 comments
Open

Unable to submit multiple params #128

antarr opened this issue Dec 5, 2019 · 0 comments

Comments

@antarr
Copy link

antarr commented Dec 5, 2019

I'm using swagger-blocks to document my API. When attempting to execute I get an error because only the last parameter listed is sent in the curl request.

app/controllers/apidocs_controller.rb

parameter :login do
  key :name, :login
  key :type, :string
  key :in, :body
  key :description, 'login used when signing in'
  key :required, true
end
parameter :email do
  key :name, :email
  key :type, :string
  key :in, :body
  key :description, 'email address associated with the new user'
  key :required, true
end
parameter :password do
  key :name, :password
  key :type, :string
  key :in, :body
  key :description, 'password the user signs in with'
  key :required, true
end

app/controllers/api/v1/users_controller.rb

  swagger_path '/users' do
    operation :post do
      key :summary, 'Create a User'
      key :description, 'Creates a User'
      key :operation, 'createUser'
      key :tags, [
        'user'
      ]
      parameter :login
      parameter :email
      parameter :password
      response 200 do
        key :description, 'create user response'
        schema do
          key :'$ref', :CreateUser
        end
      end
      response :default do
        key :description, 'unexpected error'
        schema do
          key :'$ref', :ErrorModel
        end
      end
    end
  end

generated curl request

curl -X POST "https://api.website.local:3000/users" -H "accept: application/json" -H "Content-Type: application/json" -d "somepassword"

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

No branches or pull requests

1 participant