Class: Skooma::Objects::Components

Inherits:
JSONSkooma::JSONNode
  • Object
show all
Defined in:
lib/skooma/objects/components.rb

Overview

Holds a set of reusable objects for different aspects of the OAS. spec.openapis.org/oas/v3.1.0#components-object

Constant Summary collapse

CLASSES_MAP =
{
  "schemas" => JSONSkooma::JSONSchema,
  "responses" => Response,
  "parameters" => Parameter,
  "examples" => JSONSkooma::JSONNode,
  "requestBodies" => RequestBody,
  "headers" => Header,
  "securitySchemes" => JSONSkooma::JSONNode,
  "links" => JSONSkooma::JSONNode,
  "callbacks" => JSONSkooma::JSONNode,
  "pathItems" => PathItem
}

Instance Method Summary collapse

Instance Method Details

#map_object_value(value) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/skooma/objects/components.rb', line 21

def map_object_value(value)
  value.map do |k, v|
    key = k.to_s
    value = JSONSkooma::JSONNode.new(v, key: key, parent: self, item_class: CLASSES_MAP.fetch(key), **@item_params, metaschema_uri: parent.json_schema_dialect_uri)
    [key, value]
  end.to_h
end