Class: OasContrib::OpenAPI::V3::Spec

Inherits:
Base
  • Object
show all
Defined in:
lib/oas_contrib/openapi/v3/spec.rb

Overview

Spec class

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Spec

Initialize

Parameters:

  • data (Hash)

    spec data hash



23
24
25
# File 'lib/oas_contrib/openapi/v3/spec.rb', line 23

def initialize(data)
  super
end

Instance Attribute Details

#metaObject (readonly)

Returns the value of attribute meta.



11
12
13
# File 'lib/oas_contrib/openapi/v3/spec.rb', line 11

def meta
  @meta
end

#modelObject (readonly)

Returns the value of attribute model.



19
20
21
# File 'lib/oas_contrib/openapi/v3/spec.rb', line 19

def model
  @model
end

#pathObject (readonly)

Returns the value of attribute path.



15
16
17
# File 'lib/oas_contrib/openapi/v3/spec.rb', line 15

def path
  @path
end

Instance Method Details

#mappingOpenAPI::V3::Spec

Mapping the hash to the spec object.

Returns:



29
30
31
32
33
34
# File 'lib/oas_contrib/openapi/v3/spec.rb', line 29

def mapping
  @meta  = data.select { |v| v != 'paths' && v != 'components' } || nil
  @path  = data['paths'] || nil
  @model = data.dig('components', 'schemas') || nil
  self
end