Class: GrapeOAS::ApiModel::API
- Defined in:
- lib/grape_oas/api_model/api.rb
Overview
Represents the root API object in the DTO model for OpenAPI v2/v3. Contains metadata, paths, servers, tags, and components. Used as the entry point for building OpenAPIv2 and OpenAPIv3 documents.
Constant Summary
Constants inherited from Node
Instance Attribute Summary collapse
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#components ⇒ Object
Returns the value of attribute components.
-
#host ⇒ Object
Returns the value of attribute host.
-
#nullable_strategy ⇒ Object
Returns the value of attribute nullable_strategy.
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#registered_schemas ⇒ Object
Returns the value of attribute registered_schemas.
-
#schemes ⇒ Object
Returns the value of attribute schemes.
-
#security ⇒ Object
Returns the value of attribute security.
-
#security_definitions ⇒ Object
Returns the value of attribute security_definitions.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#suppress_default_error_response ⇒ Object
Returns the value of attribute suppress_default_error_response.
-
#tag_defs ⇒ Object
Returns the value of attribute tag_defs.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from Node
Instance Method Summary collapse
- #add_path(path) ⇒ Object
- #add_tags(*tags) ⇒ Object
- #builder_cache ⇒ Object
-
#initialize(title:, version:) ⇒ API
constructor
A new instance of API.
Methods inherited from Node
Constructor Details
#initialize(title:, version:) ⇒ API
Returns a new instance of API.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/grape_oas/api_model/api.rb', line 16 def initialize(title:, version:) super() @title = title @version = version @paths = Set.new @servers = [] @tag_defs = Set.new @components = {} @host = nil @base_path = nil @schemes = [] @security_definitions = {} @security = [] @registered_schemas = [] @suppress_default_error_response = false @nullable_strategy = nil end |
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def base_path @base_path end |
#components ⇒ Object
Returns the value of attribute components.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def components @components end |
#host ⇒ Object
Returns the value of attribute host.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def host @host end |
#nullable_strategy ⇒ Object
Returns the value of attribute nullable_strategy.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def nullable_strategy @nullable_strategy end |
#paths ⇒ Object
Returns the value of attribute paths.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def paths @paths end |
#registered_schemas ⇒ Object
Returns the value of attribute registered_schemas.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def registered_schemas @registered_schemas end |
#schemes ⇒ Object
Returns the value of attribute schemes.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def schemes @schemes end |
#security ⇒ Object
Returns the value of attribute security.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def security @security end |
#security_definitions ⇒ Object
Returns the value of attribute security_definitions.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def security_definitions @security_definitions end |
#servers ⇒ Object
Returns the value of attribute servers.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def servers @servers end |
#suppress_default_error_response ⇒ Object
Returns the value of attribute suppress_default_error_response.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def suppress_default_error_response @suppress_default_error_response end |
#tag_defs ⇒ Object
Returns the value of attribute tag_defs.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def tag_defs @tag_defs end |
#title ⇒ Object
Returns the value of attribute title.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
12 13 14 |
# File 'lib/grape_oas/api_model/api.rb', line 12 def version @version end |
Instance Method Details
#add_path(path) ⇒ Object
34 35 36 |
# File 'lib/grape_oas/api_model/api.rb', line 34 def add_path(path) @paths << path end |
#add_tags(*tags) ⇒ Object
38 39 40 |
# File 'lib/grape_oas/api_model/api.rb', line 38 def (*) @tag_defs.merge() end |
#builder_cache ⇒ Object
42 43 44 |
# File 'lib/grape_oas/api_model/api.rb', line 42 def builder_cache @builder_cache ||= {} end |