module Dry::Schema::JSONSchema::SchemaMethods

Public Instance Methods

json_schema(loose: false) click to toggle source

Convert the schema into a JSON schema hash

@param [Symbol] loose Compile the schema in “loose” mode

@return [Hash<Symbol=>Hash>]

@api public

# File lib/dry/schema/extensions/json_schema.rb, line 19
def json_schema(loose: false)
  compiler = SchemaCompiler.new(root: true, loose: loose)
  compiler.call(to_ast)
  compiler.to_hash
end