Class: Raml::Root
- Inherits:
-
PropertiesNode
- Object
- Node
- PropertiesNode
- Raml::Root
- Includes:
- Parent, SecuredBy, Validation
- Defined in:
- lib/raml/node/root.rb
Overview
RAML root node. Its parent is itself.
Instance Attribute Summary collapse
-
#base_uri ⇒ String
The API base URI.
-
#base_uri_parameters ⇒ Hash<String, Raml::Parameter::BaseUriParameter>
readonly
The base URI parameters, keyed by the parameter name.
-
#documents ⇒ Array<Raml::Documentation>
readonly
The top level documentation.
-
#media_type ⇒ String
(also: #default_media_type)
The default request and response body media type.
-
#protocols ⇒ Array<String>?
The supported protocols.
-
#resource_types ⇒ Hash<String, Raml::ResourceType>
(also: #resource_type_declarations)
readonly
The resource type definitions, keyed by the resource type name.
-
#resources ⇒ Hash<String, Raml::Resource>
readonly
The nested resources, keyed by the resource relative path.
-
#schemas ⇒ Hash<String, Raml::Schema>
(also: #schema_declarations)
readonly
The schema definitions, keyed by the schema name.
-
#security_schemes ⇒ Hash<String, Raml::SecurityScheme>
(also: #security_scheme_declarations)
readonly
The security scheme definitions, keyed by the security scheme name.
-
#title ⇒ String
API title.
-
#traits ⇒ Hash<String, Raml::Trait>
(also: #trait_declarations)
readonly
The trait definitions, keyed by the trait name.
-
#version ⇒ String?
API version.
Attributes included from Parent
Attributes inherited from PropertiesNode
Attributes inherited from Node
Instance Method Summary collapse
-
#expand ⇒ Object
Applies resource types and traits, and inlines schemas.
-
#initialize(root_data) ⇒ Root
constructor
A new instance of Root.
- #resource_path ⇒ Object
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.
|
# 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.
|
# File 'lib/raml/node/root.rb', line 32
|
#documents ⇒ Array<Raml::Documentation> (readonly)
Returns the top level documentation.
|
# 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.
|
# 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”.
|
# 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.
|
# File 'lib/raml/node/root.rb', line 45
|
#resources ⇒ Hash<String, Raml::Resource> (readonly)
Returns 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.
|
# 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.
51 52 |
# File 'lib/raml/node/root.rb', line 51 scalar_property :title , :version , :base_uri , :protocols , :media_type |
#title ⇒ String
Returns 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.
|
# File 'lib/raml/node/root.rb', line 42
|
#version ⇒ String?
Returns 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 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 |