Skip to content

Commit

Permalink
doc openapi schemas' additionalProperties are schemas too
Browse files Browse the repository at this point in the history
  • Loading branch information
notEthan committed Jan 29, 2022
1 parent c93f6ef commit 0295b35
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/scorpio/openapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ module V3
describe_schema = [
openapi_document_schema.definitions['Schema'],
openapi_document_schema.definitions['SchemaReference'],
# instead of the Schema definition allowing boolean, properties['additionalProperties']
# is a oneOf which allows a Schema, SchemaReference, or boolean.
# instances of the former two already include the schema implementation (per the previous
# describes_schema entries), but the boolean does not.
# including in properties['additionalProperties'] applies to any additionalProperties.
# (including in properties['additionalProperties'].anyOf[2] would extend booleans too, without
# the redundant inclusion that results for Schema and SchemaRef, but redundant inclusion is not
# a problem, and this way also applies when none of the anyOf match due to schema errors.)
openapi_document_schema.definitions['Schema'].properties['additionalProperties'],
]
describe_schema.each { |s| s.jsi_schema_instance_modules = [JSI::Schema::Draft04] }
Expand Down Expand Up @@ -109,6 +117,7 @@ module V2
# include on its schema module the jsi_schema_instance_modules that implement schema functionality.
describe_schema = [
openapi_document_schema.definitions['schema'],
# comments above on v3's definitions['Schema'].properties['additionalProperties'] apply here too
openapi_document_schema.definitions['schema'].properties['additionalProperties'],
]
describe_schema.each { |s| s.jsi_schema_instance_modules = [JSI::Schema::Draft04] }
Expand Down

0 comments on commit 0295b35

Please sign in to comment.