mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Fixes last little pathing mistakes from rename
All specs are passing in all gems and in test-app Properly generates open api 3 swagger via rake rswag:specs:swaggerize and via bundle exec rspec in test-app dir
This commit is contained in:
parent
475929e9aa
commit
032ad5dc54
@ -1,11 +1,13 @@
|
|||||||
module OpenApi::Rswag
|
module OpenApi
|
||||||
module Api
|
module Rswag
|
||||||
class Configuration
|
module Api
|
||||||
attr_accessor :swagger_root, :swagger_filter
|
class Configuration
|
||||||
|
attr_accessor :swagger_root, :swagger_filter
|
||||||
|
|
||||||
def resolve_swagger_root(env)
|
def resolve_swagger_root(env)
|
||||||
path_params = env['action_dispatch.request.path_parameters'] || {}
|
path_params = env['action_dispatch.request.path_parameters'] || {}
|
||||||
path_params[:swagger_root] || swagger_root
|
path_params[:swagger_root] || swagger_root
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
require 'open_api/rswag/api/middleware'
|
require 'open_api/rswag/api/middleware'
|
||||||
|
|
||||||
module OpenApi::Rswag
|
module OpenApi
|
||||||
module Api
|
module Rswag
|
||||||
class Engine < ::Rails::Engine
|
module Api
|
||||||
isolate_namespace Rswag::Api
|
class Engine < ::Rails::Engine
|
||||||
|
isolate_namespace OpenApi::Rswag::Api
|
||||||
|
|
||||||
initializer 'rswag-api.initialize' do |app|
|
initializer 'rswag-api.initialize' do |app|
|
||||||
middleware.use Rswag::Api::Middleware, Rswag::Api.config
|
middleware.use OpenApi::Rswag::Api::Middleware, OpenApi::Rswag::Api.config
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -41,7 +41,7 @@ module OpenApi
|
|||||||
|
|
||||||
def validate_body!(metadata, swagger_doc, body)
|
def validate_body!(metadata, swagger_doc, body)
|
||||||
test_schemas = extract_schemas(metadata)
|
test_schemas = extract_schemas(metadata)
|
||||||
return if test_schemas.nil?
|
return if test_schemas.nil? || test_schemas.empty?
|
||||||
|
|
||||||
components = swagger_doc[:components] || {}
|
components = swagger_doc[:components] || {}
|
||||||
components_schemas = { components: { schemas: components[:schemas] } }
|
components_schemas = { components: { schemas: components[:schemas] } }
|
||||||
|
|||||||
@ -9,9 +9,9 @@ namespace :rswag do
|
|||||||
|
|
||||||
# NOTE: rspec 2.x support
|
# NOTE: rspec 2.x support
|
||||||
if OpenApi::Rswag::Specs::RSPEC_VERSION > 2 && OpenApi::Rswag::Specs.config.swagger_dry_run
|
if OpenApi::Rswag::Specs::RSPEC_VERSION > 2 && OpenApi::Rswag::Specs.config.swagger_dry_run
|
||||||
t.rspec_opts = [ '--format Rswag::Specs::SwaggerFormatter', '--dry-run', '--order defined' ]
|
t.rspec_opts = [ '--format OpenApi::Rswag::Specs::SwaggerFormatter', '--dry-run', '--order defined' ]
|
||||||
else
|
else
|
||||||
t.rspec_opts = [ '--format Rswag::Specs::SwaggerFormatter', '--order defined' ]
|
t.rspec_opts = [ '--format OpenApi::Rswag::Specs::SwaggerFormatter', '--order defined' ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -11,7 +11,7 @@ module OpenApi
|
|||||||
end
|
end
|
||||||
|
|
||||||
rake_tasks do
|
rake_tasks do
|
||||||
load File.expand_path('../../../tasks/rswag-ui_tasks.rake', __FILE__)
|
load File.expand_path('../../../../tasks/rswag-ui_tasks.rake', __FILE__)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Rswag::Api.configure do |c|
|
OpenApi::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
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Rswag::Ui.configure do |c|
|
OpenApi::Rswag::Ui.configure do |c|
|
||||||
|
|
||||||
# List the Swagger endpoints that you want to be documented through the swagger-ui
|
# 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 host) to the corresponding
|
# The first parameter is the path (absolute or relative to the UI host) to the corresponding
|
||||||
|
|||||||
@ -9,6 +9,6 @@ TestApp::Application.routes.draw do
|
|||||||
post 'auth-tests/api-key', to: 'auth_tests#api_key'
|
post 'auth-tests/api-key', to: 'auth_tests#api_key'
|
||||||
post 'auth-tests/basic-and-api-key', to: 'auth_tests#basic_and_api_key'
|
post 'auth-tests/basic-and-api-key', to: 'auth_tests#basic_and_api_key'
|
||||||
|
|
||||||
mount Rswag::Api::Engine => 'api-docs'
|
mount OpenApi::Rswag::Api::Engine => 'api-docs'
|
||||||
mount Rswag::Ui::Engine => 'api-docs'
|
mount OpenApi::Rswag::Ui::Engine => 'api-docs'
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user