Class: Raml::Root

Inherits:
PropertiesNode show all
Includes:
Parent, SecuredBy, Validation
Defined in:
lib/raml/node/root.rb

Overview

RAML root node. Its parent is itself.

Instance Attribute Summary collapse

Attributes included from Parent

#children

Attributes inherited from PropertiesNode

#optional

Attributes inherited from Node

#name, #parent

Instance Method Summary collapse

Methods included from SecuredBy

#_validate_secured_by, #parse_secured_by

Methods included from Validation

#classes_to_s, #validate_array, #validate_hash, #validate_property, #validate_string

Methods inherited from PropertiesNode

#_regexp_property, #non_scalar_properties, #scalar_properties

Constructor Details

#initialize(root_data) ⇒ Root



76
77
78
# File 'lib/raml/node/root.rb', line 76

def initialize(root_data)
  super nil, root_data, self
end

Instance Attribute Details

#base_uriString



# File 'lib/raml/node/root.rb', line 19


#base_uri_parametersHash<String, Raml::Parameter::BaseUriParameter> (readonly)



# File 'lib/raml/node/root.rb', line 32


#documentsArray<Raml::Documentation> (readonly)



# File 'lib/raml/node/root.rb', line 29


#media_typeString Also known as: default_media_type



# File 'lib/raml/node/root.rb', line 26


#protocolsArray<String>?



# File 'lib/raml/node/root.rb', line 22


#resource_typesHash<String, Raml::ResourceType> (readonly) Also known as: resource_type_declarations



# File 'lib/raml/node/root.rb', line 45


#resourcesHash<String, Raml::Resource> (readonly)



# File 'lib/raml/node/root.rb', line 39


#schemasHash<String, Raml::Schema> (readonly) Also known as: schema_declarations



# File 'lib/raml/node/root.rb', line 36


#security_schemesHash<String, Raml::SecurityScheme> (readonly) Also known as: security_scheme_declarations



51
52
# File 'lib/raml/node/root.rb', line 51

scalar_property :title      , :version    , :base_uri     ,
:protocols  , :media_type

#titleString



# File 'lib/raml/node/root.rb', line 13


#traitsHash<String, Raml::Trait> (readonly) Also known as: trait_declarations



# File 'lib/raml/node/root.rb', line 42


#versionString?



# File 'lib/raml/node/root.rb', line 16


Instance Method Details

#expandObject

Applies resource types and traits, and inlines schemas. It should be called before documentation is generated.



82
83
84
85
86
87
88
89
# File 'lib/raml/node/root.rb', line 82

def expand
  unless @expanded
    resources.values.each(&:apply_resource_type)
    resources.values.each(&:apply_traits)
    inline_reference SchemaReference, schemas, @children
    @expanded = true
  end
end

#resource_pathObject



92
93
94
# File 'lib/raml/node/root.rb', line 92

def resource_path
  ''
end