Class: Google::Apis::DiscoveryV1::JsonSchema
- Inherits:
-
Object
- Object
- Google::Apis::DiscoveryV1::JsonSchema
- Includes:
- Core::Hashable, Core::JsonObjectSupport
- Defined in:
- lib/google/apis/generator/model.rb,
generated/google/apis/discovery_v1/classes.rb,
generated/google/apis/discovery_v1/representations.rb,
generated/google/apis/discovery_v1/representations.rb
Defined Under Namespace
Classes: Annotations, Variant
Instance Attribute Summary collapse
-
#_ref ⇒ String
A reference to another schema.
-
#additional_properties ⇒ Google::Apis::DiscoveryV1::JsonSchema
If this is a schema for an object, this property is the schema for any additional properties with dynamic keys on this object.
-
#annotations ⇒ Google::Apis::DiscoveryV1::JsonSchema::Annotations
Additional information about this property.
-
#base_ref ⇒ Object
Returns the value of attribute base_ref.
-
#default ⇒ String
The default value of this property (if one exists).
-
#description ⇒ String
A description of this object.
-
#discriminant ⇒ Object
Returns the value of attribute discriminant.
-
#discriminant_value ⇒ Object
Returns the value of attribute discriminant_value.
-
#enum ⇒ Array<String>
Values this parameter may take (if it is an enum).
-
#enum_descriptions ⇒ Array<String>
The descriptions for the enums.
-
#format ⇒ String
An additional regular expression or key that helps constrain the value.
-
#generated_class_name ⇒ Object
Returns the value of attribute generated_class_name.
-
#generated_name ⇒ Object
Returns the value of attribute generated_name.
-
#id ⇒ String
Unique identifier for this schema.
-
#items ⇒ Google::Apis::DiscoveryV1::JsonSchema
If this is a schema for an array, this property is the schema for each element in the array.
-
#location ⇒ String
Whether this parameter goes in the query or the path for REST requests.
-
#maximum ⇒ String
The maximum value of this parameter.
-
#minimum ⇒ String
The minimum value of this parameter.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#path ⇒ Object
Returns the value of attribute path.
-
#pattern ⇒ String
The regular expression this parameter must conform to.
-
#properties ⇒ Hash<String,Google::Apis::DiscoveryV1::JsonSchema>
If this is a schema for an object, list the schema for each property of this object.
-
#read_only ⇒ Boolean
(also: #read_only?)
The value is read-only, generated by the service.
-
#repeated ⇒ Boolean
(also: #repeated?)
Whether this parameter may appear multiple times.
-
#required ⇒ Boolean
(also: #required?)
Whether the parameter is required.
-
#type ⇒ String
The value type for this schema.
-
#variant ⇒ Google::Apis::DiscoveryV1::JsonSchema::Variant
In a variant data type, the value of one property is used to determine how to interpret the entire entity.
Instance Method Summary collapse
- #generated_type ⇒ Object
-
#initialize(**args) ⇒ JsonSchema
constructor
A new instance of JsonSchema.
- #qualified_name ⇒ Object
-
#update!(**args) ⇒ Object
Update properties of this object.
Methods included from Core::JsonObjectSupport
Methods included from Core::Hashable
Constructor Details
#initialize(**args) ⇒ JsonSchema
Returns a new instance of JsonSchema
287 288 289 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 287 def initialize(**args) update!(**args) end |
Instance Attribute Details
#_ref ⇒ String
A reference to another schema. The value of this property is the "id" of
another schema.
Corresponds to the JSON property $ref
175 176 177 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 175 def _ref @_ref end |
#additional_properties ⇒ Google::Apis::DiscoveryV1::JsonSchema
If this is a schema for an object, this property is the schema for any
additional properties with dynamic keys on this object.
Corresponds to the JSON property additionalProperties
181 182 183 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 181 def additional_properties @additional_properties end |
#annotations ⇒ Google::Apis::DiscoveryV1::JsonSchema::Annotations
Additional information about this property.
Corresponds to the JSON property annotations
186 187 188 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 186 def annotations @annotations end |
#base_ref ⇒ Object
Returns the value of attribute base_ref
35 36 37 |
# File 'lib/google/apis/generator/model.rb', line 35 def base_ref @base_ref end |
#default ⇒ String
The default value of this property (if one exists).
Corresponds to the JSON property default
191 192 193 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 191 def default @default end |
#description ⇒ String
A description of this object.
Corresponds to the JSON property description
196 197 198 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 196 def description @description end |
#discriminant ⇒ Object
Returns the value of attribute discriminant
37 38 39 |
# File 'lib/google/apis/generator/model.rb', line 37 def discriminant @discriminant end |
#discriminant_value ⇒ Object
Returns the value of attribute discriminant_value
38 39 40 |
# File 'lib/google/apis/generator/model.rb', line 38 def discriminant_value @discriminant_value end |
#enum ⇒ Array<String>
Values this parameter may take (if it is an enum).
Corresponds to the JSON property enum
201 202 203 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 201 def enum @enum end |
#enum_descriptions ⇒ Array<String>
The descriptions for the enums. Each position maps to the corresponding value
in the "enum" array.
Corresponds to the JSON property enumDescriptions
207 208 209 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 207 def enum_descriptions @enum_descriptions end |
#format ⇒ String
An additional regular expression or key that helps constrain the value. For
more details see: http://tools.ietf.org/html/draft-zyp-json-schema-03#section-
5.23
Corresponds to the JSON property format
214 215 216 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 214 def format @format end |
#generated_class_name ⇒ Object
Returns the value of attribute generated_class_name
34 35 36 |
# File 'lib/google/apis/generator/model.rb', line 34 def generated_class_name @generated_class_name end |
#generated_name ⇒ Object
Returns the value of attribute generated_name
33 34 35 |
# File 'lib/google/apis/generator/model.rb', line 33 def generated_name @generated_name end |
#id ⇒ String
Unique identifier for this schema.
Corresponds to the JSON property id
219 220 221 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 219 def id @id end |
#items ⇒ Google::Apis::DiscoveryV1::JsonSchema
If this is a schema for an array, this property is the schema for each element
in the array.
Corresponds to the JSON property items
225 226 227 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 225 def items @items end |
#location ⇒ String
Whether this parameter goes in the query or the path for REST requests.
Corresponds to the JSON property location
230 231 232 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 230 def location @location end |
#maximum ⇒ String
The maximum value of this parameter.
Corresponds to the JSON property maximum
235 236 237 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 235 def maximum @maximum end |
#minimum ⇒ String
The minimum value of this parameter.
Corresponds to the JSON property minimum
240 241 242 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 240 def minimum @minimum end |
#name ⇒ Object
Returns the value of attribute name
32 33 34 |
# File 'lib/google/apis/generator/model.rb', line 32 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent
36 37 38 |
# File 'lib/google/apis/generator/model.rb', line 36 def parent @parent end |
#path ⇒ Object
Returns the value of attribute path
39 40 41 |
# File 'lib/google/apis/generator/model.rb', line 39 def path @path end |
#pattern ⇒ String
The regular expression this parameter must conform to. Uses Java 6 regex
format: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
Corresponds to the JSON property pattern
246 247 248 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 246 def pattern @pattern end |
#properties ⇒ Hash<String,Google::Apis::DiscoveryV1::JsonSchema>
If this is a schema for an object, list the schema for each property of this
object.
Corresponds to the JSON property properties
252 253 254 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 252 def properties Hash[(@properties || {}).sort] end |
#read_only ⇒ Boolean Also known as: read_only?
The value is read-only, generated by the service. The value cannot be modified
by the client. If the value is included in a POST, PUT, or PATCH request, it
is ignored by the service.
Corresponds to the JSON property readOnly
259 260 261 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 259 def read_only @read_only end |
#repeated ⇒ Boolean Also known as: repeated?
Whether this parameter may appear multiple times.
Corresponds to the JSON property repeated
265 266 267 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 265 def repeated @repeated end |
#required ⇒ Boolean Also known as: required?
Whether the parameter is required.
Corresponds to the JSON property required
271 272 273 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 271 def required @required end |
#type ⇒ String
The value type for this schema. A list of values can be found here: http://
tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
Corresponds to the JSON property type
278 279 280 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 278 def type @type end |
#variant ⇒ Google::Apis::DiscoveryV1::JsonSchema::Variant
In a variant data type, the value of one property is used to determine how to
interpret the entire entity. Its value must exist in a map of descriminant
values to schema names.
Corresponds to the JSON property variant
285 286 287 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 285 def variant @variant end |
Instance Method Details
#generated_type ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/google/apis/generator/model.rb', line 49 def generated_type case type when 'string', 'boolean', 'number', 'integer', 'any' return 'DateTime' if format == 'date-time' return 'Date' if format == 'date' return 'Fixnum' if format == 'int64' return 'Fixnum' if format == 'uint64' return TYPE_MAP[type] when 'array' if items == self return sprintf('Array<%s>', qualified_name) end return sprintf('Array<%s>', items.generated_type) when 'hash' if additional_properties == self return sprintf('Hash<String,%s>', qualified_name) end return sprintf('Hash<String,%s>', additional_properties.generated_type) when 'object' return qualified_name end end |
#qualified_name ⇒ Object
45 46 47 |
# File 'lib/google/apis/generator/model.rb', line 45 def qualified_name parent.qualified_name + '::' + generated_class_name end |
#update!(**args) ⇒ Object
Update properties of this object
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'generated/google/apis/discovery_v1/classes.rb', line 292 def update!(**args) @_ref = args[:_ref] if args.key?(:_ref) @additional_properties = args[:additional_properties] if args.key?(:additional_properties) @annotations = args[:annotations] if args.key?(:annotations) @default = args[:default] if args.key?(:default) @description = args[:description] if args.key?(:description) @enum = args[:enum] if args.key?(:enum) @enum_descriptions = args[:enum_descriptions] if args.key?(:enum_descriptions) @format = args[:format] if args.key?(:format) @id = args[:id] if args.key?(:id) @items = args[:items] if args.key?(:items) @location = args[:location] if args.key?(:location) @maximum = args[:maximum] if args.key?(:maximum) @minimum = args[:minimum] if args.key?(:minimum) @pattern = args[:pattern] if args.key?(:pattern) @properties = args[:properties] if args.key?(:properties) @read_only = args[:read_only] if args.key?(:read_only) @repeated = args[:repeated] if args.key?(:repeated) @required = args[:required] if args.key?(:required) @type = args[:type] if args.key?(:type) @variant = args[:variant] if args.key?(:variant) end |