Class: Swagger::DSL
- Inherits:
-
Hash
- Object
- Hash
- Swagger::DSL
- Includes:
- ResolveModule
- Defined in:
- lib/swagger/dsl.rb,
lib/swagger/dsl/config.rb,
lib/swagger/dsl/version.rb,
lib/swagger/dsl/operation.rb,
lib/swagger/dsl/parameter.rb,
lib/swagger/dsl/components.rb,
lib/swagger/dsl/parameters.rb,
lib/swagger/dsl/serializer.rb,
lib/swagger/dsl/json_schema.rb,
lib/swagger/dsl/resolve_module.rb,
lib/swagger/dsl/rails_controller.rb,
lib/swagger/dsl/json_schema/jimmy.rb,
lib/swagger/dsl/parameters_in_type.rb,
lib/swagger/dsl/json_schema/subset_dsl.rb
Defined Under Namespace
Modules: RailsController, ResolveModule, Serializer Classes: Components, Config, JsonSchema, Operation, Parameter, Parameters, ParametersInType
Constant Summary collapse
- VERSION =
"2.0.5".freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#define_paths_procs ⇒ Object
readonly
Returns the value of attribute define_paths_procs.
Class Method Summary collapse
Instance Method Summary collapse
- #define_paths! ⇒ Object
-
#initialize(schema = nil, config: Config.new) ⇒ DSL
constructor
A new instance of DSL.
Methods included from ResolveModule
#resolve, #resolved, #resolver
Constructor Details
#initialize(schema = nil, config: Config.new) ⇒ DSL
Returns a new instance of DSL.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/swagger/dsl.rb', line 20 def initialize(schema = nil, config: Config.new) merge!(schema || {}) self["openapi"] ||= "3.0.0" self["info"] ||= { "title" => "OpenAPI schema", "version" => "0.0.0" } self["paths"] ||= {} self["components"] ||= {} self["components"]["schemas"] = Components[self["components"]["schemas"] || {}] @config = config @define_paths_procs = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
18 19 20 |
# File 'lib/swagger/dsl.rb', line 18 def config @config end |
#define_paths_procs ⇒ Object (readonly)
Returns the value of attribute define_paths_procs.
18 19 20 |
# File 'lib/swagger/dsl.rb', line 18 def define_paths_procs @define_paths_procs end |
Class Method Details
.current ⇒ Object
13 14 15 |
# File 'lib/swagger/dsl.rb', line 13 def current @current ||= new end |
Instance Method Details
#define_paths! ⇒ Object
31 32 33 |
# File 'lib/swagger/dsl.rb', line 31 def define_paths! define_paths_procs.each(&:call) end |