Skip to content

Commit

Permalink
Update Rswag configuration to use 'openapi' instead of 'swagger'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jan 5, 2024
1 parent e3c61a0 commit 9b3e50d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions config/initializers/rswag_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# 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
c.swagger_root = Rails.root.to_s + '/openapi'
c.openapi_root = Rails.root.to_s + '/openapi'

# 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
# For example, you could leverage this to dynamically assign the "host" property
#
#c.swagger_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] }
#c.openapi_filter = lambda { |swagger, env| swagger['host'] = env['HTTP_HOST'] }
end
4 changes: 2 additions & 2 deletions config/initializers/rswag_ui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# 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
# endpoint and the second is a title that will be displayed in the document selector
# NOTE: If you're using rspec-api to expose Swagger files (under swagger_root) as JSON or YAML endpoints,
# NOTE: If you're using rspec-api to expose Swagger files (under openapi_root) as JSON or YAML endpoints,
# then the list below should correspond to the relative paths for those endpoints

c.swagger_endpoint '/docs/api/v1/openapi.yaml', 'API V1 Docs'
c.openapi_endpoint '/docs/api/v1/openapi.yaml', 'API V1 Docs'

# Add Basic Auth in case your API is private
# c.basic_auth_enabled = true
Expand Down

0 comments on commit 9b3e50d

Please sign in to comment.