Module: Swagger::V2::DeterministicJSONSchema

Included in:
Header, Parameter
Defined in:
lib/swagger/v2/deterministic_json_schema.rb

Overview

A Swagger Schema Object, which is subset of JSON-Schema that's constrainted to be more deterministic.

Instance Attribute Summary collapse

Instance Attribute Details

#$ref($ref) ⇒ Object

JSON-Schema field $ref.

Returns:

  • String



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#defaultObject

JSON-Schema field default.

Returns:

  • Object



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#descriptionObject

JSON-Schema field description.

Returns:

  • String



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#discriminatorObject

Swagger Schema field discriminator.

Returns:

  • String



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/swagger/v2/deterministic_json_schema.rb', line 93

def self.included(base) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  # Subset of standard JSON schema
  base.field :$ref, String
  base.field :format, String
  base.field :title, String
  base.field :description, String
  base.field :default, Object
  base.field :multipleOf, Numeric
  base.field :maximum, Numeric
  base.field :exclusiveMaximum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMaximum?, :exclusiveMaximum)
  base.field :minimum, Numeric
  base.field :exclusiveMinimum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMinimum?, :exclusiveMinimum)
  base.field :maxLength, Integer
  base.field :minLength, Integer
  base.field :pattern, String
  base.field :maxItems, Integer
  base.field :minItems, Integer
  base.field :uniqueItems, Swagger::Boolean
  base.send(:alias_method, :uniqueItems?, :uniqueItems)
  base.field :maxProperties, Integer
  base.field :minProperties, Integer
  base.field :required, Swagger::Boolean
  base.send(:alias_method, :required?, :required)
  base.field :enum, Array[Object]
  base.field :type, Object

  # Swagger extensions to JSON schema :\
  base.field :discriminator, String
  base.field :readOnly, Swagger::Boolean
  base.field :xml, Object # TODO: Swagger XML object / XML support
  base.field :externalDocs, Object # TODO: ExternalDocumentation class
  base.field :example, Object
end

#enumObject

JSON-Schema field enum.



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#exampleObject

Swagger Schema field example.

Returns:

  • Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/swagger/v2/deterministic_json_schema.rb', line 93

def self.included(base) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  # Subset of standard JSON schema
  base.field :$ref, String
  base.field :format, String
  base.field :title, String
  base.field :description, String
  base.field :default, Object
  base.field :multipleOf, Numeric
  base.field :maximum, Numeric
  base.field :exclusiveMaximum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMaximum?, :exclusiveMaximum)
  base.field :minimum, Numeric
  base.field :exclusiveMinimum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMinimum?, :exclusiveMinimum)
  base.field :maxLength, Integer
  base.field :minLength, Integer
  base.field :pattern, String
  base.field :maxItems, Integer
  base.field :minItems, Integer
  base.field :uniqueItems, Swagger::Boolean
  base.send(:alias_method, :uniqueItems?, :uniqueItems)
  base.field :maxProperties, Integer
  base.field :minProperties, Integer
  base.field :required, Swagger::Boolean
  base.send(:alias_method, :required?, :required)
  base.field :enum, Array[Object]
  base.field :type, Object

  # Swagger extensions to JSON schema :\
  base.field :discriminator, String
  base.field :readOnly, Swagger::Boolean
  base.field :xml, Object # TODO: Swagger XML object / XML support
  base.field :externalDocs, Object # TODO: ExternalDocumentation class
  base.field :example, Object
end

#exclusiveMaximumObject

JSON-Schema field exclusiveMaximum.

Returns:

  • boolean



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#exclusiveMinimumObject

JSON-Schema field exclusiveMinimum.

Returns:

  • boolean



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#externalDocsObject

Swagger Schema field externalDocs.

Returns:

  • ExternalDocumentation



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/swagger/v2/deterministic_json_schema.rb', line 93

def self.included(base) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  # Subset of standard JSON schema
  base.field :$ref, String
  base.field :format, String
  base.field :title, String
  base.field :description, String
  base.field :default, Object
  base.field :multipleOf, Numeric
  base.field :maximum, Numeric
  base.field :exclusiveMaximum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMaximum?, :exclusiveMaximum)
  base.field :minimum, Numeric
  base.field :exclusiveMinimum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMinimum?, :exclusiveMinimum)
  base.field :maxLength, Integer
  base.field :minLength, Integer
  base.field :pattern, String
  base.field :maxItems, Integer
  base.field :minItems, Integer
  base.field :uniqueItems, Swagger::Boolean
  base.send(:alias_method, :uniqueItems?, :uniqueItems)
  base.field :maxProperties, Integer
  base.field :minProperties, Integer
  base.field :required, Swagger::Boolean
  base.send(:alias_method, :required?, :required)
  base.field :enum, Array[Object]
  base.field :type, Object

  # Swagger extensions to JSON schema :\
  base.field :discriminator, String
  base.field :readOnly, Swagger::Boolean
  base.field :xml, Object # TODO: Swagger XML object / XML support
  base.field :externalDocs, Object # TODO: ExternalDocumentation class
  base.field :example, Object
end

#formatObject

JSON-Schema field format.

Returns:

  • String



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#maximumObject

JSON-Schema field maximum.

Returns:

  • Numeric



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#maxItemsObject

JSON-Schema field maxItems.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#maxLengthObject

JSON-Schema field maxLength.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#maxPropertiesObject

JSON-Schema field maxProperties.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#minimumObject

JSON-Schema field minimum.

Returns:

  • Numeric



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#minItemsObject

JSON-Schema field minItems.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#minLengthObject

JSON-Schema field minLength.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#minPropertiesObject

JSON-Schema field minProperties.

Returns:

  • Integer



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#multipleOfObject

JSON-Schema field multipleOf.

Returns:

  • Object



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#patternObject

JSON-Schema field pattern.

Returns:

  • Regexp



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#readOnlyObject

Swagger Schema field readOnly.

Returns:

  • boolean



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/swagger/v2/deterministic_json_schema.rb', line 93

def self.included(base) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  # Subset of standard JSON schema
  base.field :$ref, String
  base.field :format, String
  base.field :title, String
  base.field :description, String
  base.field :default, Object
  base.field :multipleOf, Numeric
  base.field :maximum, Numeric
  base.field :exclusiveMaximum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMaximum?, :exclusiveMaximum)
  base.field :minimum, Numeric
  base.field :exclusiveMinimum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMinimum?, :exclusiveMinimum)
  base.field :maxLength, Integer
  base.field :minLength, Integer
  base.field :pattern, String
  base.field :maxItems, Integer
  base.field :minItems, Integer
  base.field :uniqueItems, Swagger::Boolean
  base.send(:alias_method, :uniqueItems?, :uniqueItems)
  base.field :maxProperties, Integer
  base.field :minProperties, Integer
  base.field :required, Swagger::Boolean
  base.send(:alias_method, :required?, :required)
  base.field :enum, Array[Object]
  base.field :type, Object

  # Swagger extensions to JSON schema :\
  base.field :discriminator, String
  base.field :readOnly, Swagger::Boolean
  base.field :xml, Object # TODO: Swagger XML object / XML support
  base.field :externalDocs, Object # TODO: ExternalDocumentation class
  base.field :example, Object
end

#requiredObject

JSON-Schema field required.

Returns:

  • boolean



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#titleObject

JSON-Schema field title.

Returns:

  • String



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#typeObject

JSON-Schema field type.

Returns:

  • Object



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#uniqueItemsObject

JSON-Schema field uniqueItems.

Returns:

  • boolean



# File 'lib/swagger/v2/deterministic_json_schema.rb', line 9

#xmlObject

Swagger Schema field xml.

Returns:

  • Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/swagger/v2/deterministic_json_schema.rb', line 93

def self.included(base) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
  # Subset of standard JSON schema
  base.field :$ref, String
  base.field :format, String
  base.field :title, String
  base.field :description, String
  base.field :default, Object
  base.field :multipleOf, Numeric
  base.field :maximum, Numeric
  base.field :exclusiveMaximum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMaximum?, :exclusiveMaximum)
  base.field :minimum, Numeric
  base.field :exclusiveMinimum, Swagger::Boolean
  base.send(:alias_method, :exclusiveMinimum?, :exclusiveMinimum)
  base.field :maxLength, Integer
  base.field :minLength, Integer
  base.field :pattern, String
  base.field :maxItems, Integer
  base.field :minItems, Integer
  base.field :uniqueItems, Swagger::Boolean
  base.send(:alias_method, :uniqueItems?, :uniqueItems)
  base.field :maxProperties, Integer
  base.field :minProperties, Integer
  base.field :required, Swagger::Boolean
  base.send(:alias_method, :required?, :required)
  base.field :enum, Array[Object]
  base.field :type, Object

  # Swagger extensions to JSON schema :\
  base.field :discriminator, String
  base.field :readOnly, Swagger::Boolean
  base.field :xml, Object # TODO: Swagger XML object / XML support
  base.field :externalDocs, Object # TODO: ExternalDocumentation class
  base.field :example, Object
end