Class: Eazypi::Parameter
- Inherits:
-
Object
- Object
- Eazypi::Parameter
- Includes:
- SpecObject
- Defined in:
- lib/eazypi/parameter.rb
Overview
OpenAPI spec ParameterObject
Instance Method Summary collapse
-
#initialize(name:, location:, &block) ⇒ Parameter
constructor
A new instance of Parameter.
- #to_openapi_spec ⇒ Object
Methods included from SpecObject
Constructor Details
#initialize(name:, location:, &block) ⇒ Parameter
Returns a new instance of Parameter.
18 19 20 21 22 23 |
# File 'lib/eazypi/parameter.rb', line 18 def initialize(name:, location:, &block) @name = name @location = location super(&block) end |
Instance Method Details
#to_openapi_spec ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/eazypi/parameter.rb', line 25 def to_openapi_spec { "name" => name.to_s, "in" => location, # using location as in is a ruby keywork "description" => description, "required" => location == "path" ? true : required, "deprecated" => depcrecated, "allowEmptyValue" => allow_empty_value, "schema" => schema ? Schema.from_object(schema).to_openapi_spec : nil }.compact end |