Remove all commented code. Add "nullable"

This commit is contained in:
Greg Myers
2020-04-04 23:37:38 +01:00
parent b158f1e164
commit d644a91da5
11 changed files with 26 additions and 353 deletions

View File

@@ -62,40 +62,6 @@ module Rswag
end
end
## OA3
# describe '#request_body_json(schema)' do
# let(:api_metadata) { { path_item: {}, operation: {} } } # i.e. operation defined
# context 'when required is not supplied' do
# before { subject.request_body_json(schema: { type: 'object' }) }
# it 'adds required true by default' do
# expect(api_metadata[:operation][:requestBody]).to match(
# required: true, content: { 'application/json' => { schema: { type: 'object' } } }
# )
# end
# end
# context 'when required is supplied' do
# before { subject.request_body_json(schema: { type: 'object' }, required: false) }
# it 'adds required false' do
# expect(api_metadata[:operation][:requestBody]).to match(
# required: false, content: { 'application/json' => { schema: { type: 'object' } } }
# )
# end
# end
# context 'when required is supplied' do
# before { subject.request_body_json(schema: { type: 'object' }, description: 'my description') }
# it 'adds description' do
# expect(api_metadata[:operation][:requestBody]).to match(
# description: 'my description', required: true, content: { 'application/json' => { schema: { type: 'object' } } }
# )
# end
# end
# end
describe '#parameter(attributes)' do
context "when called at the 'path' level" do
before { subject.parameter(name: :blog, in: :body, schema: { type: 'object' }) }

View File

@@ -63,8 +63,6 @@ module Rswag
'/blogs/1/comments/2?q1=foo&api_key=fookey',
'{"text":"Some comment"}',
{ 'CONTENT_TYPE' => 'application/json' }
## OA3
# 'CONTENT_TYPE' => 'application/json'
)
end
end

View File

@@ -249,10 +249,6 @@ module Rswag
context 'apiKey' do
before do
swagger_doc[:securityDefinitions] = { apiKey: { type: :apiKey, name: 'api_key', in: key_location } }
## OA3
# swagger_doc[:components] = { securitySchemes: {
# apiKey: { type: :apiKey, name: 'api_key', in: key_location }
# } }
metadata[:operation][:security] = [apiKey: []]
allow(example).to receive(:api_key).and_return('foobar')
end
@@ -294,10 +290,6 @@ module Rswag
context 'oauth2' do
before do
swagger_doc[:securityDefinitions] = { oauth2: { type: :oauth2, scopes: ['read:blogs'] } }
## OA3
# swagger_doc[:components] = { securitySchemes: {
# oauth2: { type: :oauth2, scopes: ['read:blogs'] }
# } }
metadata[:operation][:security] = [oauth2: ['read:blogs']]
allow(example).to receive(:Authorization).and_return('Bearer foobar')
end
@@ -313,11 +305,6 @@ module Rswag
basic: { type: :basic },
api_key: { type: :apiKey, name: 'api_key', in: :query }
}
## OA3
# swagger_doc[:components] = { securitySchemes: {
# basic: { type: :basic },
# api_key: { type: :apiKey, name: 'api_key', in: :query }
# } }
metadata[:operation][:security] = [{ basic: [], api_key: [] }]
allow(example).to receive(:Authorization).and_return('Basic foobar')
allow(example).to receive(:api_key).and_return('foobar')
@@ -406,8 +393,6 @@ module Rswag
context 'global security requirements' do
before do
swagger_doc[:securityDefinitions] = { apiKey: { type: :apiKey, name: 'api_key', in: :query } }
## OA3
# swagger_doc[:components] = { securitySchemes: { apiKey: { type: :apiKey, name: 'api_key', in: :query } } }
swagger_doc[:security] = [apiKey: []]
allow(example).to receive(:api_key).and_return('foobar')
end

View File

@@ -24,16 +24,6 @@ module Rswag
properties: { text: { type: :string } },
required: ['text']
}
## OA3
# content: {
# 'application/json' => {
# schema: {
# type: :object,
# properties: { text: { type: :string } },
# required: ['text']
# }
# }
# }
}
}
end