swagger-blocks icon indicating copy to clipboard operation
swagger-blocks copied to clipboard

Unable to submit multiple params

Open antarr opened this issue 5 years ago • 0 comments

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"

antarr avatar Dec 05 '19 21:12 antarr