Module: Dry::Schema::OpenAPI::SchemaMethods

Defined in:
lib/dry/schema/extensions/open_api.rb

Instance Method Summary collapse

Instance Method Details

#open_api(loose: false) ⇒ Hash<Symbol=>Hash>

Convert the schema into a JSON schema hash

Parameters:

  • loose (Symbol) (defaults to: false)

    Compile the schema in “loose” mode

Returns:

  • (Hash<Symbol=>Hash>)


19
20
21
22
23
# File 'lib/dry/schema/extensions/open_api.rb', line 19

def open_api(loose: false)
  compiler = SchemaCompiler.new(root: true, loose: loose)
  compiler.call(to_ast)
  compiler.to_hash
end