DRY, shorten swagger file names

This commit is contained in:
Maikel Linke
2023-09-05 14:28:57 +10:00
parent fe2eecb69e
commit 7654d37fc3
14 changed files with 14 additions and 14 deletions

View File

@@ -28,7 +28,7 @@ jobs:
with:
mapi-token: ${{ secrets.MAPI_TOKEN }}
api-url: http://localhost:3000
api-spec: swagger/v1/swagger.yaml
api-spec: swagger/v1.yaml
target: openfoodfoundation/openfoodnetwork
duration: 1min
sarif-report: mapi.sarif

View File

@@ -9,8 +9,8 @@ Rswag::Ui.configure do |config|
# (under swagger_root) as JSON or YAML endpoints, then the list below should
# correspond to the relative paths for those endpoints.
config.swagger_endpoint 'v1/swagger.yaml', 'API V1 Docs'
config.swagger_endpoint 'dfc-v1.7/swagger.yaml', 'OFN DFC API Docs'
config.swagger_endpoint 'v1.yaml', 'API V1 Docs'
config.swagger_endpoint 'dfc.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 DfcProvider::Engine.root.join("spec/swagger_helper")
describe "Addresses", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rswag_autodoc: true do
describe "Addresses", type: :request, swagger_doc: "dfc.yaml", rswag_autodoc: true do
let(:user) { create(:oidc_user) }
let(:address) { create(:address, id: 40_000) }
let(:result) { json_response }

View File

@@ -2,7 +2,7 @@
require_relative "../swagger_helper"
describe "CatalogItems", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml",
describe "CatalogItems", type: :request, swagger_doc: "dfc.yaml",
rswag_autodoc: true do
let(:user) { create(:oidc_user, id: 12_345) }
let(:enterprise) {

View File

@@ -2,7 +2,7 @@
require_relative "../swagger_helper"
describe "Enterprises", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rswag_autodoc: true do
describe "Enterprises", type: :request, swagger_doc: "dfc.yaml", rswag_autodoc: true do
let!(:user) { create(:oidc_user) }
let!(:enterprise) do
create(

View File

@@ -2,7 +2,7 @@
require_relative "../swagger_helper"
describe "Persons", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rswag_autodoc: true do
describe "Persons", type: :request, swagger_doc: "dfc.yaml", rswag_autodoc: true do
let(:user) { create(:oidc_user, id: 10_000) }
let(:other_user) { create(:oidc_user) }

View File

@@ -2,7 +2,7 @@
require_relative "../swagger_helper"
describe "SuppliedProducts", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml",
describe "SuppliedProducts", type: :request, swagger_doc: "dfc.yaml",
rswag_autodoc: true do
let!(:user) { create(:oidc_user) }
let!(:enterprise) { create(:distributor_enterprise, id: 10_000, owner: user) }

View File

@@ -6,7 +6,7 @@ require_relative "spec_helper"
RSpec.configure do |config|
# Override swagger docs to generate only this file:
config.swagger_docs = {
'dfc-v1.7/swagger.yaml' => {
'dfc.yaml' => {
openapi: '3.0.1',
info: {
title: 'OFN DFC API',

View File

@@ -2,7 +2,7 @@
require 'swagger_helper'
describe 'api/v0/orders', swagger_doc: 'v0/swagger.yaml', type: :request do
describe 'api/v0/orders', swagger_doc: 'v0.yaml', type: :request do
path '/api/v0/orders' do
get('list orders') do
tags 'Orders'

View File

@@ -2,7 +2,7 @@
require "swagger_helper"
describe "Customers", type: :request, swagger_doc: "v1/swagger.yaml" do
describe "Customers", type: :request, swagger_doc: "v1.yaml" do
let!(:enterprise1) { create(:enterprise, name: "The Farm") }
let!(:enterprise2) { create(:enterprise) }
let!(:enterprise3) { create(:enterprise) }

View File

@@ -14,7 +14,7 @@ describe "API documentation", type: :request do
end
it "can load the Swagger config" do
get "/api-docs/v1/swagger.yaml"
get "/api-docs/v1.yaml"
expect(response).to have_http_status :success
end
end

View File

@@ -18,7 +18,7 @@ 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 = {
'v1/swagger.yaml' => {
'v1.yaml' => {
openapi: '3.0.1',
info: {
title: 'API V1',
@@ -57,7 +57,7 @@ RSpec.configure do |config|
{ url: "/" }
]
},
'v0/swagger.yaml' => {
'v0.yaml' => {
openapi: '3.0.1',
info: {
title: 'API V0',