Class: Jsapi::Meta::Example::Model
- Defined in:
- lib/jsapi/meta/example/model.rb
Instance Method Summary collapse
-
#description ⇒ Object
:attr: description The optional description of the example.
-
#external ⇒ Object
:attr: external If true,
valueis interpreted as a URI pointing to an external sample value. -
#summary ⇒ Object
:attr: summary The optional summary of the example.
-
#to_openapi ⇒ Object
Returns a hash representing the OpenAPI example object.
-
#value ⇒ Object
:attr: value The sample value.
Methods inherited from Base
#initialize, #inspect, #reference?, #resolve
Methods included from Attributes::ClassMethods
Constructor Details
This class inherits a constructor from Jsapi::Meta::Base
Instance Method Details
#description ⇒ Object
:attr: description The optional description of the example.
10 |
# File 'lib/jsapi/meta/example/model.rb', line 10 attribute :description, String |
#external ⇒ Object
:attr: external If true, value is interpreted as a URI pointing to an external sample value.
16 |
# File 'lib/jsapi/meta/example/model.rb', line 16 attribute :external, values: [true, false] |
#summary ⇒ Object
:attr: summary The optional summary of the example.
21 |
# File 'lib/jsapi/meta/example/model.rb', line 21 attribute :summary, String |
#to_openapi ⇒ Object
Returns a hash representing the OpenAPI example object.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jsapi/meta/example/model.rb', line 29 def to_openapi(*) {}.tap do |hash| hash[:summary] = summary if summary.present? hash[:description] = description if description.present? if external? hash[:external_value] = value else hash[:value] = value end end end |
#value ⇒ Object
:attr: value The sample value.
26 |
# File 'lib/jsapi/meta/example/model.rb', line 26 attribute :value |