-
Notifications
You must be signed in to change notification settings - Fork 64
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
Can we remove required parameters for request body? #195
Comments
It is to add a test case that use only required parameters. it `...` do
# use all parameters
end
it `...` do
# use only required parameters
end Then, rspec-openapi exclude unused parameters from |
@exoego Thank you. I want it to have no required field. I mean all parameters are optional.
I tried this, and it didn't work though what you showed worked. |
Hmm, that is strange. These tests correspond to this feature (automatic rspec-openapi/spec/requests/rails_smart_merge_spec.rb Lines 65 to 92 in d8ea652
The below fixture illustrates the result. Always-specified parameters are included in rspec-openapi/spec/rails/doc/smart/expected.yaml Lines 399 to 419 in d8ea652
|
@exoego Your example works, but it doesn't work when I try to make all the parameters optional like below. it 'returns 201' do
params = {
param1: true,
param2: true,
param3: true
}
patch api_path, params: params, headers: token
expect(response.status).to eq 201
end
it 'returns 201' do
params = {}
patch api_path, params: params, headers: token
expect(response.status).to eq 201
end |
@exoego Thank you! |
When I generate a document, parameters for request body are set as required.
Is there any way to set the parameters optional?
I would like to remove the following required section.
The text was updated successfully, but these errors were encountered: