Class: Swagger::V2::APIDeclaration
- Inherits:
-
APIDeclaration
- Object
- Hashie::Dash
- DefinitionSection
- APIDeclaration
- Swagger::V2::APIDeclaration
- Defined in:
- lib/swagger/v2/api_declaration.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#apis ⇒ Object
readonly
def initialize(hash) super attach_to_apis end.
-
#info ⇒ Info
Required.
-
#paths ⇒ Hash[String => Path]
Required.
-
#swagger ⇒ Float
Required.
Attributes inherited from DefinitionSection
Instance Method Summary collapse
Methods inherited from APIDeclaration
Methods inherited from DefinitionSection
#initialize, required_section, section
Methods included from Attachable
#attach_parent, #attach_to_children, #root
Constructor Details
This class inherits a constructor from Swagger::APIDeclaration
Instance Attribute Details
#apis ⇒ Object (readonly)
def initialize(hash)
super
attach_to_apis
end
24 25 26 |
# File 'lib/swagger/v2/api_declaration.rb', line 24 def apis @apis end |
#info ⇒ Info
Required.
12 |
# File 'lib/swagger/v2/api_declaration.rb', line 12 required_section :info, Info |
#paths ⇒ Hash[String => Path]
Required.
13 |
# File 'lib/swagger/v2/api_declaration.rb', line 13 required_section :paths, Hash[String => Path] |
#swagger ⇒ Float
Required.
11 |
# File 'lib/swagger/v2/api_declaration.rb', line 11 required_section :swagger, Float |
Instance Method Details
#fully_validate ⇒ Object
46 47 48 49 50 51 |
# File 'lib/swagger/v2/api_declaration.rb', line 46 def fully_validate # FIXME: fully_validate is ideal, but very slow with the current schema/validator errors = JSON::Validator.fully_validate(swagger_schema, to_json) fail Swagger::InvalidDefinition, errors unless errors.empty? true end |
#uri_template ⇒ Object
40 41 42 43 44 |
# File 'lib/swagger/v2/api_declaration.rb', line 40 def uri_template # TODO: Can calculated values be safely memoized? # TODO: Actual URI Template objects or just strings? "#{host}#{basePath}" end |
#validate ⇒ Object
53 54 55 56 57 |
# File 'lib/swagger/v2/api_declaration.rb', line 53 def validate JSON::Validator.validate!(swagger_schema, to_json) rescue JSON::Schema::ValidationError => e raise Swagger::InvalidDefinition, e. end |