rspec_api_documentation icon indicating copy to clipboard operation
rspec_api_documentation copied to clipboard

Only one required parameter showing as required (Open API writer)

Open qortex opened this issue 6 years ago • 2 comments

with_options scope: :user, type: :string, , required: true, with_example: true do
  parameter :email, 'User email (login)'
  parameter :password, 'Plain password'
end

or even

with_options scope: :user, type: :string, with_example: true do
  parameter :email, 'User email (login)', required: true
  parameter :password, 'Plain password', required: true
end

only outputs email as required in the open_api output.

with_options scope: :user, type: :string, with_example: true do
  parameter :email, 'User email (login)',
  parameter :password, 'Plain password', required: true
end

shows password properly as required. So it seems only one item can be marked as required in the open_api writer.

qortex avatar Jan 12 '19 18:01 qortex

Having the same problem. I even tried adding parameters without #with_options method, it didn't work anyway. Only the first parameter, which is marked as required, will be added to the list of required fields in the generated JSON.

vetalpaprotsky avatar Jan 22 '19 16:01 vetalpaprotsky

The problem seems to be on how extract_schema is leading with multiple fields on the OpenApiWriter

rennanoliveira avatar Apr 15 '19 13:04 rennanoliveira