Class: JSONSchema
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- JSONSchema
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
36460 36461 36462 36463 36464 36465 36466 36467 |
# File 'lib/schemas.rb', line 36460 def self.from_dynamic!(d) d = Types::Hash[d] new( input: d["input"], json_schema_options: d["options"], json_schema_type: d["type"], ) end |
.from_json!(json) ⇒ Object
36469 36470 36471 |
# File 'lib/schemas.rb', line 36469 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
36473 36474 36475 36476 36477 36478 36479 |
# File 'lib/schemas.rb', line 36473 def to_dynamic { "input" => input, "options" => , "type" => json_schema_type, } end |
#to_json(options = nil) ⇒ Object
36481 36482 36483 |
# File 'lib/schemas.rb', line 36481 def to_json( = nil) JSON.generate(to_dynamic, ) end |