Class: Jsapi::Meta::OpenAPI::ServerVariable

Inherits:
Base
  • Object
show all
Defined in:
lib/jsapi/meta/openapi/server_variable.rb

Overview

Represents a server variable object.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #reference?, #resolve

Methods included from Attributes::ClassMethods

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base

Instance Method Details

#defaultObject

:attr: default The default value of the server variable.



11
# File 'lib/jsapi/meta/openapi/server_variable.rb', line 11

attribute :default, String

#descriptionObject

:attr: description The optional description of the server variable.



16
# File 'lib/jsapi/meta/openapi/server_variable.rb', line 16

attribute :description, String

#enumObject

:attr: enum The values of the server variable.



21
# File 'lib/jsapi/meta/openapi/server_variable.rb', line 21

attribute :enum, [String]

#to_openapiObject

Returns a hash representing the server variable object.



24
25
26
27
28
29
30
# File 'lib/jsapi/meta/openapi/server_variable.rb', line 24

def to_openapi(*)
  {
    default: default,
    enum: enum.presence, # must not be empty
    description: description
  }.compact
end