Skip to content

Commit

Permalink
dev [jsi v0.3] openapi Schema and Reference schemas extend(JSI::Schem…
Browse files Browse the repository at this point in the history
…a::DescribesSchema)
  • Loading branch information
notEthan committed Dec 26, 2019
1 parent cc8af10 commit ab6a547
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/scorpio/openapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ module V3
LinkWithOperationId = openapi_class.call('definitions', 'LinkWithOperationId')
Callback = openapi_class.call('definitions', 'Callback')
Encoding = openapi_class.call('definitions', 'Encoding')

# the schema of Scorpio::OpenAPI::V3::Schema describes a schema itself, so we extend it
# with the module indicating that.
Schema.schema.extend(JSI::Schema::DescribesSchema)
Reference.schema.extend(JSI::Schema::DescribesSchema)
end
module V2
openapi_schema = JSI::Schema.new(::JSON.parse(Scorpio.root.join('documents/swagger.io/v2/schema.json').read))
Expand Down Expand Up @@ -149,6 +154,11 @@ module V2
UniqueItems = openapi_class.call('definitions', 'uniqueItems')
Enum = openapi_class.call('definitions', 'enum')
JsonReference = openapi_class.call('definitions', 'jsonReference')

# the schema of Scorpio::OpenAPI::V2::Schema describes a schema itself, so we extend it
# with the module indicating that.
Schema.schema.extend(JSI::Schema::DescribesSchema)
JsonReference.schema.extend(JSI::Schema::DescribesSchema)
end

begin
Expand Down

0 comments on commit ab6a547

Please sign in to comment.