mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #11278 from mkllnk/swagger-fix
Fix swagger-api integration after last update
This commit is contained in:
@@ -5,7 +5,7 @@ Rswag::Api.configure do |config|
|
||||
# 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
|
||||
# that it's configured to generate files in the same folder
|
||||
config.swagger_root = Rails.root.join("swagger")
|
||||
config.swagger_root = Rails.root.join("swagger").to_s
|
||||
|
||||
# Inject a lamda function to alter the returned Swagger prior to serialization
|
||||
# The function will have access to the rack env for the current request
|
||||
|
||||
20
spec/requests/api_docs_spec.rb
Normal file
20
spec/requests/api_docs_spec.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe "API documentation", type: :request do
|
||||
it "shows the OFN API v1" do
|
||||
get rswag_ui_path
|
||||
expect(response).to redirect_to "/api-docs/index.html"
|
||||
|
||||
get "/api-docs/index.html"
|
||||
expect(response).to have_http_status :success
|
||||
|
||||
expect(response.body).to match "API V1"
|
||||
end
|
||||
|
||||
it "can load the Swagger config" do
|
||||
get "/api-docs/v1/swagger.yaml"
|
||||
expect(response).to have_http_status :success
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user