28_introduce_rswag #35
5 changed files with 8 additions and 10 deletions
|
@ -1,5 +1,4 @@
|
||||||
Rswag::Api.configure do |c|
|
Rswag::Api.configure do |c|
|
||||||
|
|
||||||
# Specify a root folder where Swagger JSON files are located
|
# Specify a root folder where Swagger JSON files are located
|
||||||
# This is used by the Swagger middleware to serve requests for API descriptions
|
# This is used by the Swagger middleware to serve requests for API descriptions
|
||||||
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure
|
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure
|
||||||
|
@ -10,5 +9,5 @@ Rswag::Api.configure do |c|
|
||||||
# The function will have access to the rack env for the current request
|
# The function will have access to the rack env for the current request
|
||||||
# For example, you could leverage this to dynamically assign the "host" property
|
# For example, you could leverage this to dynamically assign the "host" property
|
||||||
#
|
#
|
||||||
#c.swagger_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] }
|
# c.swagger_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
Rswag::Ui.configure do |c|
|
Rswag::Ui.configure do |c|
|
||||||
|
|
||||||
# List the Swagger endpoints that you want to be documented through the
|
# List the Swagger endpoints that you want to be documented through the
|
||||||
# swagger-ui. The first parameter is the path (absolute or relative to the UI
|
# swagger-ui. The first parameter is the path (absolute or relative to the UI
|
||||||
# host) to the corresponding endpoint and the second is a title that will be
|
# host) to the corresponding endpoint and the second is a title that will be
|
||||||
|
|
|
@ -7,7 +7,7 @@ module ApiHelper
|
||||||
let(:api_access_token) { create(:oauth2_access_token, resource_owner_id: user.id, scopes: api_scopes&.join(' ')).token }
|
let(:api_access_token) { create(:oauth2_access_token, resource_owner_id: user.id, scopes: api_scopes&.join(' ')).token }
|
||||||
let(:Authorization) { "Bearer #{api_access_token}" }
|
let(:Authorization) { "Bearer #{api_access_token}" }
|
||||||
|
|
||||||
def self.it_handles_invalid_token()
|
def self.it_handles_invalid_token
|
||||||
context 'with invalid access token' do
|
context 'with invalid access token' do
|
||||||
let(:Authorization) { 'abc' }
|
let(:Authorization) { 'abc' }
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ module ApiHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.it_handles_invalid_scope()
|
def self.it_handles_invalid_scope
|
||||||
context 'with invalid scope' do
|
context 'with invalid scope' do
|
||||||
let(:api_scopes) { ['none'] }
|
let(:api_scopes) { ['none'] }
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ RSpec.configure do |config|
|
||||||
'finance:write': 'reading and creating financial transactions',
|
'finance:write': 'reading and creating financial transactions',
|
||||||
'user:read': 'reading your own user profile',
|
'user:read': 'reading your own user profile',
|
||||||
'user:write': 'reading and updating your own user profile',
|
'user:write': 'reading and updating your own user profile',
|
||||||
offline_access: 'retain access after user has logged out',
|
offline_access: 'retain access after user has logged out'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,9 +120,9 @@ RSpec.configure do |config|
|
||||||
],
|
],
|
||||||
security: [
|
security: [
|
||||||
oauth2: [
|
oauth2: [
|
||||||
'user:read',
|
'user:read'
|
||||||
],
|
]
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue