diff --git a/config/initializers/rswag_ui.rb b/config/initializers/rswag_ui.rb index e5b4bf11f8..3f79f997b2 100644 --- a/config/initializers/rswag_ui.rb +++ b/config/initializers/rswag_ui.rb @@ -10,6 +10,7 @@ Rswag::Ui.configure do |config| # correspond to the relative paths for those endpoints. config.swagger_endpoint '/api-docs/v1/swagger.yaml', 'API V1 Docs' + config.swagger_endpoint '/api-docs/dfc-v1.7/swagger.yaml', 'OFN DFC API Docs' # Add Basic Auth in case your API is private # config.basic_auth_enabled = true diff --git a/spec/requests/api/v1/customers_spec.rb b/spec/requests/api/v1/customers_spec.rb index a44a753a16..9d22d456d1 100644 --- a/spec/requests/api/v1/customers_spec.rb +++ b/spec/requests/api/v1/customers_spec.rb @@ -2,7 +2,7 @@ require "swagger_helper" -describe "Customers", type: :request do +describe "Customers", type: :request, swagger_doc: "v1/swagger.yaml" do let!(:enterprise1) { create(:enterprise, name: "The Farm") } let!(:enterprise2) { create(:enterprise) } let!(:enterprise3) { create(:enterprise) } diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index bebca37075..f34ff3dccb 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -18,6 +18,44 @@ RSpec.configure do |config| # document below. You can override this behavior by adding a swagger_doc tag to the # the root example_group in your specs, e.g. describe '...', swagger_doc: 'v2/swagger.json' config.swagger_docs = { + 'dfc-v1.7/swagger.yaml' => { + openapi: '3.0.1', + info: { + title: 'OFN DFC API', + version: 'v0.1.7' + }, + components: { + securitySchemes: { + oidc_token: { + type: :http, + scheme: :bearer, + bearerFormat: "JWT", + description: "OpenID Connect token from a trusted platform" + }, + ofn_api_token: { + type: :apiKey, + in: :header, + name: 'X-Api-Token', + description: "API token of an authorized OFN user" + }, + ofn_session: { + type: :apiKey, + in: :cookie, + name: '_ofn_session', + description: "Session cookie of a logged in OFN user" + }, + } + }, + security: [ + { oidc_token: [] }, + { ofn_api_token: [] }, + { ofn_session: [] }, + ], + paths: {}, + servers: [ + { url: "/" }, + ] + }, 'v1/swagger.yaml' => { openapi: '3.0.1', info: { diff --git a/swagger/dfc-v1.7/swagger.yaml b/swagger/dfc-v1.7/swagger.yaml new file mode 100644 index 0000000000..41387bb4c3 --- /dev/null +++ b/swagger/dfc-v1.7/swagger.yaml @@ -0,0 +1,29 @@ +--- +openapi: 3.0.1 +info: + title: OFN DFC API + version: v0.1.7 +components: + securitySchemes: + oidc_token: + type: http + scheme: bearer + bearerFormat: JWT + description: OpenID Connect token from a trusted platform + ofn_api_token: + type: apiKey + in: header + name: X-Api-Token + description: API token of an authorized OFN user + ofn_session: + type: apiKey + in: cookie + name: _ofn_session + description: Session cookie of a logged in OFN user +security: +- oidc_token: [] +- ofn_api_token: [] +- ofn_session: [] +paths: {} +servers: +- url: "/"