Class: Skooma::Objects::RefBase

Inherits:
Base
  • Object
show all
Defined in:
lib/skooma/objects/ref_base.rb

Overview

A simple object to allow referencing other components in the OpenAPI document. spec.openapis.org/oas/v3.1.0#referenceObject

Direct Known Subclasses

Callback, Header, Parameter, PathItem, RequestBody, Response

Constant Summary

Constants inherited from Base

Base::DEFAULT_OPTIONS

Instance Method Summary collapse

Methods inherited from Base

#bootstrap, #initialize, #json_schema_dialect_uri, #kw_classes

Methods included from ExternalRefs

#resolve_ref

Constructor Details

This class inherits a constructor from Skooma::Objects::Base

Instance Method Details

#ref_kw_classesObject



16
17
18
19
20
21
22
# File 'lib/skooma/objects/ref_base.rb', line 16

def ref_kw_classes
  [
    JSONSkooma::Keywords::Core::Ref,
    Base::Keywords::Summary,
    Base::Keywords::Description
  ]
end

#resolve_keywords(value) ⇒ Object

This object cannot be extended with additional properties and any properties added SHALL be ignored.



10
11
12
13
14
# File 'lib/skooma/objects/ref_base.rb', line 10

def resolve_keywords(value)
  return super unless value.key?("$ref")

  resolve_ref_keywords(value)
end

#resolve_ref_keywords(value) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/skooma/objects/ref_base.rb', line 24

def resolve_ref_keywords(value)
  ref_kw_classes.each do |kw_class|
    next unless value.key?(kw_class.key)

    add_keyword(kw_class.new(self, value[kw_class.key]))
  end
end