Class: Anchor::JSONSchema::SchemaGenerator
- Inherits:
-
SchemaGenerator
- Object
- SchemaGenerator
- Anchor::JSONSchema::SchemaGenerator
- Defined in:
- lib/anchor/json_schema/schema_generator.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(register:, context: {}, include_all_fields: false, exclude_fields: nil) ⇒ SchemaGenerator
constructor
rubocop:disable Lint/MissingSuper.
Methods inherited from SchemaGenerator
Constructor Details
#initialize(register:, context: {}, include_all_fields: false, exclude_fields: nil) ⇒ SchemaGenerator
rubocop:disable Lint/MissingSuper
5 6 7 8 9 10 |
# File 'lib/anchor/json_schema/schema_generator.rb', line 5 def initialize(register:, context: {}, include_all_fields: false, exclude_fields: nil) # rubocop:disable Lint/MissingSuper @register = register @context = context @include_all_fields = include_all_fields @exclude_fields = exclude_fields end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/anchor/json_schema/schema_generator.rb', line 12 def call result = { "$schema" => "https://json-schema.org/draft-07/schema", title: "Schema", } result.merge!(type_property(root_object)) result["$defs"] = definitions result.to_json end |