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:
Jay Danielian 2019-08-01 09:10:38 -04:00
parent 475929e9aa
commit 032ad5dc54
8 changed files with 25 additions and 21 deletions

View File

@ -1,11 +1,13 @@
module OpenApi::Rswag
module Api
class Configuration
attr_accessor :swagger_root, :swagger_filter
module OpenApi
module Rswag
module Api
class Configuration
attr_accessor :swagger_root, :swagger_filter
def resolve_swagger_root(env)
path_params = env['action_dispatch.request.path_parameters'] || {}
path_params[:swagger_root] || swagger_root
def resolve_swagger_root(env)
path_params = env['action_dispatch.request.path_parameters'] || {}
path_params[:swagger_root] || swagger_root
end
end
end
end

View File

@ -1,12 +1,14 @@
require 'open_api/rswag/api/middleware'
module OpenApi::Rswag
module Api
class Engine < ::Rails::Engine
isolate_namespace Rswag::Api
module OpenApi
module Rswag
module Api
class Engine < ::Rails::Engine
isolate_namespace OpenApi::Rswag::Api
initializer 'rswag-api.initialize' do |app|
middleware.use Rswag::Api::Middleware, Rswag::Api.config
initializer 'rswag-api.initialize' do |app|
middleware.use OpenApi::Rswag::Api::Middleware, OpenApi::Rswag::Api.config
end
end
end
end

View File

@ -41,7 +41,7 @@ module OpenApi
def validate_body!(metadata, swagger_doc, body)
test_schemas = extract_schemas(metadata)
return if test_schemas.nil?
return if test_schemas.nil? || test_schemas.empty?
components = swagger_doc[:components] || {}
components_schemas = { components: { schemas: components[:schemas] } }

View File

@ -9,9 +9,9 @@ namespace :rswag do
# NOTE: rspec 2.x support
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
t.rspec_opts = [ '--format Rswag::Specs::SwaggerFormatter', '--order defined' ]
t.rspec_opts = [ '--format OpenApi::Rswag::Specs::SwaggerFormatter', '--order defined' ]
end
end
end

View File

@ -11,7 +11,7 @@ module OpenApi
end
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

View File

@ -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
# This is used by the Swagger middleware to serve requests for API descriptions

View File

@ -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
# The first parameter is the path (absolute or relative to the UI host) to the corresponding

View File

@ -9,6 +9,6 @@ TestApp::Application.routes.draw do
post 'auth-tests/api-key', to: 'auth_tests#api_key'
post 'auth-tests/basic-and-api-key', to: 'auth_tests#basic_and_api_key'
mount Rswag::Api::Engine => 'api-docs'
mount Rswag::Ui::Engine => 'api-docs'
mount OpenApi::Rswag::Api::Engine => 'api-docs'
mount OpenApi::Rswag::Ui::Engine => 'api-docs'
end