Class: JsonSchemaView::JsonWorldExtensions::AnyOf
- Inherits:
-
Object
- Object
- JsonSchemaView::JsonWorldExtensions::AnyOf
- Defined in:
- lib/json_schema_view/json_world_extensions/any_of.rb
Overview
This class implements ‘anyOf` schema composition. Instances of this class acts as an json world compatible object and prints the schema for anyOf combination.
Defined Under Namespace
Modules: DSL
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #as_json_schema ⇒ Object (also: #as_json_schema_without_links)
-
#initialize(*types) ⇒ AnyOf
constructor
A new instance of AnyOf.
Constructor Details
#initialize(*types) ⇒ AnyOf
Returns a new instance of AnyOf.
30 31 32 |
# File 'lib/json_schema_view/json_world_extensions/any_of.rb', line 30 def initialize(*types) @types = types end |
Instance Attribute Details
#types ⇒ Object (readonly)
Returns the value of attribute types.
28 29 30 |
# File 'lib/json_schema_view/json_world_extensions/any_of.rb', line 28 def types @types end |
Instance Method Details
#as_json_schema ⇒ Object Also known as: as_json_schema_without_links
34 35 36 |
# File 'lib/json_schema_view/json_world_extensions/any_of.rb', line 34 def as_json_schema { "anyOf" => types.map(&:as_json_schema) } end |