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

Returns a new instance of 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_uri ⇒ String

Returns the API base URI.

Returns:

  • (String) —

    the API base URI.



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

#base_uri_parameters ⇒ Hash<String, Raml::Parameter::BaseUriParameter> (readonly)

Returns the base URI parameters, keyed by the parameter name.

Returns:



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

#documents ⇒ Array<Raml::Documentation> (readonly)

Returns the top level documentation.

Returns:



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

#media_type ⇒ String Also known as: default_media_type

Returns the default request and response body media type.

Returns:

  • (String) —

    the default request and response body media type.



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

#protocols ⇒ Array<String>?

Returns the supported protocols. Nil or an array of up to two string elements from the set "HTTP" and "HTTPS".

Returns:

  • (Array<String>, nil) —

    the supported protocols. Nil or an array of up to two string elements from the set "HTTP" and "HTTPS".



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

#resource_types ⇒ Hash<String, Raml::ResourceType> (readonly) Also known as: resource_type_declarations

Returns the resource type definitions, keyed by the resource type name.

Returns:



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

#resources ⇒ Hash<String, Raml::Resource> (readonly)

Returns the nested resources, keyed by the resource relative path.

Returns:

  • (Hash<String, Raml::Resource>) —

    the nested resources, keyed by the resource relative path.



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

#schemas ⇒ Hash<String, Raml::Schema> (readonly) Also known as: schema_declarations

Returns the schema definitions, keyed by the schema name.

Returns:

  • (Hash<String, Raml::Schema>) —

    the schema definitions, keyed by the schema name.



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

#security_schemes ⇒ Hash<String, Raml::SecurityScheme> (readonly) Also known as: security_scheme_declarations

Returns the security scheme definitions, keyed by the security scheme name.

Returns:



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

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

#title ⇒ String

Returns API title.

Returns:

  • (String) —

    API title.



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

#traits ⇒ Hash<String, Raml::Trait> (readonly) Also known as: trait_declarations

Returns the trait definitions, keyed by the trait name.

Returns:

  • (Hash<String, Raml::Trait>) —

    the trait definitions, keyed by the trait name.



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

#version ⇒ String?

Returns API version.

Returns:

  • (String, nil) —

    API version.



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

Instance Method Details

#expand ⇒ Object

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_path ⇒ Object



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

def resource_path
  ''
end