Class: JSON::SchemaDsl::Renderers::Desugar
- Defined in:
- lib/json/schema_dsl/renderers/desugar.rb
Overview
By default the first renderer that visits the tree. This renderer will translate all kinds of ‘syntax sugar` to a uniform format that fits json-schema.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#visit(entity) ⇒ Object
Desugars all syntax sugar in that entity.
Methods inherited from Base
Constructor Details
This class inherits a constructor from JSON::SchemaDsl::Renderers::Base
Instance Method Details
#visit(entity) ⇒ Object
Desugars all syntax sugar in that entity. This resolves concepts like ‘children` and `nullable` that are not present in the json schema specification itself but are used by the builder to ease the writing of schemas. In turn it
-
Transforms children to properties
-
Translates the ‘:required` attribute to the parent if true.
-
Collapses the item attribute of arrays into a single entity.
18 19 20 |
# File 'lib/json/schema_dsl/renderers/desugar.rb', line 18 def visit(entity) traverse((nullable(entity))) end |