Class: Jsapi::Meta::Example::Model
- Inherits:
-
Base::Model
- Object
- Base::Model
- Jsapi::Meta::Example::Model
- Includes:
- OpenAPI::Extensions
- Defined in:
- lib/jsapi/meta/example/model.rb
Overview
Specifies an example object.
Constant Summary
Constants included from Base::Attributes
Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH
Instance Method Summary collapse
-
#description ⇒ Object
:attr: description The description of the example.
-
#external ⇒ Object
:attr: external If true,
value
is interpreted as a URI pointing to an external sample value. -
#summary ⇒ Object
:attr: summary The summary of the example.
-
#to_openapi ⇒ Object
Returns a hash representing the OpenAPI example object.
-
#value ⇒ Object
:attr: value The sample value.
Methods included from OpenAPI::Extensions
#add_openapi_extension, #openapi_extensions, #openapi_extensions=
Methods inherited from Base::Model
#initialize, #inspect, #merge!, #reference?, #resolve
Methods included from Base::Attributes
Constructor Details
This class inherits a constructor from Jsapi::Meta::Base::Model
Instance Method Details
#description ⇒ Object
:attr: description The description of the example.
13 |
# File 'lib/jsapi/meta/example/model.rb', line 13 attribute :description, String |
#external ⇒ Object
:attr: external If true, value
is interpreted as a URI pointing to an external sample value.
18 |
# File 'lib/jsapi/meta/example/model.rb', line 18 attribute :external, values: [true, false] |
#summary ⇒ Object
:attr: summary The summary of the example.
23 |
# File 'lib/jsapi/meta/example/model.rb', line 23 attribute :summary, String |
#to_openapi ⇒ Object
Returns a hash representing the OpenAPI example object.
31 32 33 34 35 36 37 38 39 |
# File 'lib/jsapi/meta/example/model.rb', line 31 def to_openapi(*) with_openapi_extensions(summary: summary, description: description).tap do |hash| if external? hash[:external_value] = value else hash[:value] = value end end end |
#value ⇒ Object
:attr: value The sample value.
28 |
# File 'lib/jsapi/meta/example/model.rb', line 28 attribute :value |