Class: OpenApi::DSL::CombinedSchema
- Inherits:
-
Hash
- Object
- Hash
- OpenApi::DSL::CombinedSchema
- Includes:
- Helpers
- Defined in:
- lib/oas_objs/combined_schema.rb
Overview
Instance Attribute Summary collapse
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#processed ⇒ Object
Returns the value of attribute processed.
-
#schemas ⇒ Object
Returns the value of attribute schemas.
Instance Method Summary collapse
-
#initialize(combined_schema) ⇒ CombinedSchema
constructor
A new instance of CombinedSchema.
- #process ⇒ Object
Methods included from Helpers
#_combined_schema, #arrow_writing_support, #process_schema_input
Constructor Details
#initialize(combined_schema) ⇒ CombinedSchema
Returns a new instance of CombinedSchema.
12 13 14 15 16 |
# File 'lib/oas_objs/combined_schema.rb', line 12 def initialize(combined_schema) combined_schema.delete_if { |_, v| v.nil? } self.mode = combined_schema.keys.first.to_s.camelize(:lower).to_sym self.schemas = combined_schema.values.first end |
Instance Attribute Details
#mode ⇒ Object
Returns the value of attribute mode.
10 11 12 |
# File 'lib/oas_objs/combined_schema.rb', line 10 def mode @mode end |
#processed ⇒ Object
Returns the value of attribute processed.
10 11 12 |
# File 'lib/oas_objs/combined_schema.rb', line 10 def processed @processed end |
#schemas ⇒ Object
Returns the value of attribute schemas.
10 11 12 |
# File 'lib/oas_objs/combined_schema.rb', line 10 def schemas @schemas end |
Instance Method Details
#process ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/oas_objs/combined_schema.rb', line 18 def process self.processed = { mode => schemas.map do |schema| type = schema.is_a?(Hash) ? schema[:type] : schema schema = { } unless schema.is_a?(Hash) SchemaObj.new(type, schema).process end } end |