mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Updates specs to add 3.0 compliant structure and tests around the new schema/structure
This commit is contained in:
@@ -43,7 +43,9 @@ module Rswag
|
||||
# TODO: setup travis CI?
|
||||
|
||||
# MUST HAVES
|
||||
# TODO: look at integrating and documenting the rest of the responses in the blog_spec and get a clean 3.0 output
|
||||
# TODO: fix the specs in the rswag-specs gem
|
||||
# TODO: look at handling different ways schemas can be defined in 3.0 for requestBody and response
|
||||
# can we handle all of them?
|
||||
# Then can look at handling different request_body things like $ref, etc
|
||||
# TODO: look at adding request_body method to handle diffs in Open API 2.0 to 3.0
|
||||
# TODO: look at adding examples in content request_body
|
||||
|
||||
@@ -40,7 +40,8 @@ module Rswag
|
||||
def derive_security_params(metadata, swagger_doc)
|
||||
requirements = metadata[:operation][:security] || swagger_doc[:security] || []
|
||||
scheme_names = requirements.flat_map(&:keys)
|
||||
schemes = (swagger_doc[:components][:securitySchemes] || {}).slice(*scheme_names).values
|
||||
components = swagger_doc[:components] || {}
|
||||
schemes = (components[:securitySchemes] || {}).slice(*scheme_names).values
|
||||
|
||||
schemes.map do |scheme|
|
||||
param = scheme[:type] == :apiKey ? scheme.slice(:name, :in) : { name: 'Authorization', in: :header }
|
||||
|
||||
@@ -42,7 +42,8 @@ module Rswag
|
||||
response_schema = metadata[:response][:schema]
|
||||
return if response_schema.nil?
|
||||
|
||||
components_schemas = { components: { schemas: swagger_doc[:components][:schemas] } }
|
||||
components = swagger_doc[:components] || {}
|
||||
components_schemas = { components: { schemas: components[:schemas] } }
|
||||
|
||||
validation_schema = response_schema
|
||||
.merge('$schema' => 'http://tempuri.org/rswag/specs/extended_schema')
|
||||
|
||||
Reference in New Issue
Block a user