Announce the new DFC endpoint

We need to declare in each spec file for which endpoint the spec is
because it was just choosing the first declared one by default. The
first one was v1 and now it's dfc-v1.7.
This commit is contained in:
Maikel Linke
2023-06-22 11:25:33 +10:00
parent de51a7833d
commit 8368a6ccc9
4 changed files with 69 additions and 1 deletions

View File

@@ -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

View File

@@ -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) }

View File

@@ -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: {

View File

@@ -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: "/"