class R2OAS::Schema::V3::FromFiles::OpenapiObject

Public Class Methods

new(doc, opts = {}) click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 14
def initialize(doc, opts = {})
  super(opts)
  @doc = doc
  set_root_doc(doc)
  set_components_name_list(doc)
end

Public Instance Methods

to_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 21
def to_doc
  execute_transform_plugins(:setup)
  # MEMO:
  # Make sure paths_doc is run first
  # This is because the components object is stored in the store by executing paths_doc
  # and it is looped to generate the component document.
  result = {
    'openapi' => '3.0.0',
    'info' => info_doc,
    'tags' => @doc['tags'],
    'paths' => paths_doc,
    'externalDocs' => external_docs_doc,
    'servers' => @doc['servers'],
    'components' => components_doc
  }
  execute_transform_plugins(:teardown)
  result
end

Private Instance Methods

components_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 54
def components_doc
  ComponentsObject.new(@doc['components'], @opts).to_doc
end
external_docs_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 50
def external_docs_doc
  ExternalDocumentObject.new(@doc['externalDocs'], @opts).to_doc
end
info_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 42
def info_doc
  InfoObject.new(@doc['info'], @opts).to_doc
end
paths_doc() click to toggle source
# File lib/r2-oas/schema/v3/object/from_files/openapi_object.rb, line 46
def paths_doc
  PathsObject.new(@doc['paths'], @opts).to_doc
end