ruby-linstor-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +86 -0
- data/LICENSE +21 -0
- data/README.md +21 -0
- data/Rakefile +10 -0
- data/codegen.sh +22 -0
- data/generator/custom/one_of_drbd_resource_definition_layer.rb +7 -0
- data/generator/custom/one_of_drbd_volume_definition.rb +7 -0
- data/generator/custom/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +11 -0
- data/generator/openapi-generator.yaml +11 -0
- data/generator/template/Gemfile.mustache +9 -0
- data/generator/template/README.mustache +148 -0
- data/generator/template/Rakefile.mustache +10 -0
- data/generator/template/api.mustache +209 -0
- data/generator/template/api_client.mustache +264 -0
- data/generator/template/api_client_faraday_partial.mustache +136 -0
- data/generator/template/api_client_spec.mustache +220 -0
- data/generator/template/api_client_typhoeus_partial.mustache +153 -0
- data/generator/template/api_doc.mustache +118 -0
- data/generator/template/api_error.mustache +49 -0
- data/generator/template/api_info.mustache +12 -0
- data/generator/template/api_test.mustache +47 -0
- data/generator/template/base_object.mustache +120 -0
- data/generator/template/configuration.mustache +385 -0
- data/generator/template/configuration_spec.mustache +34 -0
- data/generator/template/configuration_tls_faraday_partial.mustache +29 -0
- data/generator/template/configuration_tls_typhoeus_partial.mustache +34 -0
- data/generator/template/gem.mustache +53 -0
- data/generator/template/gemspec.mustache +35 -0
- data/generator/template/git_push.sh.mustache +57 -0
- data/generator/template/gitignore.mustache +39 -0
- data/generator/template/model.mustache +26 -0
- data/generator/template/model_doc.mustache +12 -0
- data/generator/template/model_test.mustache +77 -0
- data/generator/template/partial_model_enum_class.mustache +20 -0
- data/generator/template/partial_model_generic.mustache +371 -0
- data/generator/template/partial_model_generic_doc.mustache +28 -0
- data/generator/template/partial_oneof_module.mustache +137 -0
- data/generator/template/partial_oneof_module_doc.mustache +92 -0
- data/generator/template/rspec.mustache +2 -0
- data/generator/template/rubocop.mustache +148 -0
- data/generator/template/spec_helper.mustache +103 -0
- data/generator/template/travis.mustache +14 -0
- data/generator/template/version.mustache +7 -0
- data/lib/ruby-linstor-client/api/developers_api.rb +5856 -0
- data/lib/ruby-linstor-client/api_client.rb +393 -0
- data/lib/ruby-linstor-client/api_error.rb +57 -0
- data/lib/ruby-linstor-client/configuration.rb +298 -0
- data/lib/ruby-linstor-client/models/api_call_rc.rb +293 -0
- data/lib/ruby-linstor-client/models/auto_place_request.rb +245 -0
- data/lib/ruby-linstor-client/models/auto_select_filter.rb +305 -0
- data/lib/ruby-linstor-client/models/candidate.rb +248 -0
- data/lib/ruby-linstor-client/models/controller_props_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/controller_version.rb +245 -0
- data/lib/ruby-linstor-client/models/drbd_proxy_enable.rb +219 -0
- data/lib/ruby-linstor-client/models/drbd_proxy_modify.rb +288 -0
- data/lib/ruby-linstor-client/models/drbd_resource.rb +276 -0
- data/lib/ruby-linstor-client/models/drbd_resource_definition_layer.rb +283 -0
- data/lib/ruby-linstor-client/models/drbd_volume.rb +285 -0
- data/lib/ruby-linstor-client/models/drbd_volume_definition.rb +236 -0
- data/lib/ruby-linstor-client/models/error_report.rb +252 -0
- data/lib/ruby-linstor-client/models/key_value_store.rb +231 -0
- data/lib/ruby-linstor-client/models/key_value_store_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/layer_type.rb +40 -0
- data/lib/ruby-linstor-client/models/luks_resource.rb +220 -0
- data/lib/ruby-linstor-client/models/luks_volume.rb +275 -0
- data/lib/ruby-linstor-client/models/max_volume_sizes.rb +229 -0
- data/lib/ruby-linstor-client/models/net_interface.rb +309 -0
- data/lib/ruby-linstor-client/models/node.rb +381 -0
- data/lib/ruby-linstor-client/models/node_modify.rb +252 -0
- data/lib/ruby-linstor-client/models/nvme_resource.rb +220 -0
- data/lib/ruby-linstor-client/models/nvme_volume.rb +266 -0
- data/lib/ruby-linstor-client/models/one_of_drbd_resource_definition_layer.rb +7 -0
- data/lib/ruby-linstor-client/models/one_of_drbd_volume_definition.rb +7 -0
- data/lib/ruby-linstor-client/models/one_of_drbd_volume_luks_volume_storage_nvme_volme_writecache_volume.rb +11 -0
- data/lib/ruby-linstor-client/models/pass_phrase_create.rb +227 -0
- data/lib/ruby-linstor-client/models/physical_storage.rb +238 -0
- data/lib/ruby-linstor-client/models/physical_storage_create.rb +337 -0
- data/lib/ruby-linstor-client/models/physical_storage_device.rb +245 -0
- data/lib/ruby-linstor-client/models/physical_storage_storage_pool_create.rb +232 -0
- data/lib/ruby-linstor-client/models/provider_kind.rb +43 -0
- data/lib/ruby-linstor-client/models/resource.rb +278 -0
- data/lib/ruby-linstor-client/models/resource_connection.rb +261 -0
- data/lib/ruby-linstor-client/models/resource_connection_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/resource_create.rb +238 -0
- data/lib/ruby-linstor-client/models/resource_definition.rb +295 -0
- data/lib/ruby-linstor-client/models/resource_definition_create.rb +262 -0
- data/lib/ruby-linstor-client/models/resource_definition_layer.rb +228 -0
- data/lib/ruby-linstor-client/models/resource_definition_modify.rb +274 -0
- data/lib/ruby-linstor-client/models/resource_group.rb +262 -0
- data/lib/ruby-linstor-client/models/resource_group_modify.rb +261 -0
- data/lib/ruby-linstor-client/models/resource_group_spawn.rb +255 -0
- data/lib/ruby-linstor-client/models/resource_layer.rb +283 -0
- data/lib/ruby-linstor-client/models/resource_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/resource_state.rb +218 -0
- data/lib/ruby-linstor-client/models/resource_with_volumes.rb +297 -0
- data/lib/ruby-linstor-client/models/resource_with_volumes_all_of.rb +220 -0
- data/lib/ruby-linstor-client/models/snapshot.rb +282 -0
- data/lib/ruby-linstor-client/models/snapshot_restore.rb +236 -0
- data/lib/ruby-linstor-client/models/snapshot_volume_definition.rb +228 -0
- data/lib/ruby-linstor-client/models/storage_pool.rb +333 -0
- data/lib/ruby-linstor-client/models/storage_pool_definition.rb +230 -0
- data/lib/ruby-linstor-client/models/storage_pool_definition_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/storage_resource.rb +220 -0
- data/lib/ruby-linstor-client/models/storage_volume.rb +256 -0
- data/lib/ruby-linstor-client/models/volume.rb +327 -0
- data/lib/ruby-linstor-client/models/volume_definition.rb +277 -0
- data/lib/ruby-linstor-client/models/volume_definition_create.rb +232 -0
- data/lib/ruby-linstor-client/models/volume_definition_layer.rb +233 -0
- data/lib/ruby-linstor-client/models/volume_definition_modify.rb +264 -0
- data/lib/ruby-linstor-client/models/volume_group.rb +251 -0
- data/lib/ruby-linstor-client/models/volume_group_modify.rb +255 -0
- data/lib/ruby-linstor-client/models/volume_layer.rb +228 -0
- data/lib/ruby-linstor-client/models/volume_modify.rb +243 -0
- data/lib/ruby-linstor-client/models/volume_state.rb +218 -0
- data/lib/ruby-linstor-client/models/writecache_resource.rb +220 -0
- data/lib/ruby-linstor-client/models/writecache_volume.rb +266 -0
- data/lib/ruby-linstor-client/version.rb +15 -0
- data/lib/ruby-linstor-client.rb +109 -0
- data/pkg/ruby-linstor-client-1.0.0.gem +0 -0
- data/ruby-linstor-client.gemspec +39 -0
- data/spec/api/developers_api_spec.rb +1116 -0
- data/spec/api_client_spec.rb +188 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/api_call_rc_spec.rb +70 -0
- data/spec/models/auto_place_request_spec.rb +46 -0
- data/spec/models/auto_select_filter_spec.rb +82 -0
- data/spec/models/candidate_spec.rb +52 -0
- data/spec/models/controller_props_modify_spec.rb +46 -0
- data/spec/models/controller_version_spec.rb +52 -0
- data/spec/models/drbd_proxy_enable_spec.rb +34 -0
- data/spec/models/drbd_proxy_modify_spec.rb +56 -0
- data/spec/models/drbd_resource_definition_layer_spec.rb +76 -0
- data/spec/models/drbd_resource_spec.rb +70 -0
- data/spec/models/drbd_volume_definition_spec.rb +46 -0
- data/spec/models/drbd_volume_spec.rb +76 -0
- data/spec/models/error_report_spec.rb +52 -0
- data/spec/models/key_value_store_modify_spec.rb +46 -0
- data/spec/models/key_value_store_spec.rb +40 -0
- data/spec/models/layer_type_spec.rb +28 -0
- data/spec/models/luks_resource_spec.rb +34 -0
- data/spec/models/luks_volume_spec.rb +70 -0
- data/spec/models/max_volume_sizes_spec.rb +40 -0
- data/spec/models/net_interface_spec.rb +68 -0
- data/spec/models/node_modify_spec.rb +52 -0
- data/spec/models/node_spec.rb +102 -0
- data/spec/models/nvme_resource_spec.rb +34 -0
- data/spec/models/nvme_volume_spec.rb +64 -0
- data/spec/models/pass_phrase_create_spec.rb +40 -0
- data/spec/models/physical_storage_create_spec.rb +80 -0
- data/spec/models/physical_storage_device_spec.rb +52 -0
- data/spec/models/physical_storage_spec.rb +46 -0
- data/spec/models/physical_storage_storage_pool_create_spec.rb +40 -0
- data/spec/models/provider_kind_spec.rb +28 -0
- data/spec/models/resource_connection_modify_spec.rb +46 -0
- data/spec/models/resource_connection_spec.rb +58 -0
- data/spec/models/resource_create_spec.rb +46 -0
- data/spec/models/resource_definition_create_spec.rb +58 -0
- data/spec/models/resource_definition_layer_spec.rb +40 -0
- data/spec/models/resource_definition_modify_spec.rb +64 -0
- data/spec/models/resource_definition_spec.rb +76 -0
- data/spec/models/resource_group_modify_spec.rb +58 -0
- data/spec/models/resource_group_spawn_spec.rb +52 -0
- data/spec/models/resource_group_spec.rb +58 -0
- data/spec/models/resource_layer_spec.rb +76 -0
- data/spec/models/resource_modify_spec.rb +46 -0
- data/spec/models/resource_spec.rb +70 -0
- data/spec/models/resource_state_spec.rb +34 -0
- data/spec/models/resource_with_volumes_all_of_spec.rb +34 -0
- data/spec/models/resource_with_volumes_spec.rb +76 -0
- data/spec/models/snapshot_restore_spec.rb +40 -0
- data/spec/models/snapshot_spec.rb +70 -0
- data/spec/models/snapshot_volume_definition_spec.rb +40 -0
- data/spec/models/storage_pool_definition_modify_spec.rb +46 -0
- data/spec/models/storage_pool_definition_spec.rb +40 -0
- data/spec/models/storage_pool_spec.rb +94 -0
- data/spec/models/storage_resource_spec.rb +34 -0
- data/spec/models/storage_volume_spec.rb +58 -0
- data/spec/models/volume_definition_create_spec.rb +40 -0
- data/spec/models/volume_definition_layer_spec.rb +40 -0
- data/spec/models/volume_definition_modify_spec.rb +58 -0
- data/spec/models/volume_definition_spec.rb +64 -0
- data/spec/models/volume_group_modify_spec.rb +52 -0
- data/spec/models/volume_group_spec.rb +52 -0
- data/spec/models/volume_layer_spec.rb +40 -0
- data/spec/models/volume_modify_spec.rb +46 -0
- data/spec/models/volume_spec.rb +100 -0
- data/spec/models/volume_state_spec.rb +34 -0
- data/spec/models/writecache_resource_spec.rb +34 -0
- data/spec/models/writecache_volume_spec.rb +64 -0
- data/spec/spec_helper.rb +111 -0
- metadata +344 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
{{> api_info}}
|
|
3
|
+
=end
|
|
4
|
+
|
|
5
|
+
require 'spec_helper'
|
|
6
|
+
require 'json'
|
|
7
|
+
require 'date'
|
|
8
|
+
|
|
9
|
+
# Unit tests for {{moduleName}}::{{classname}}
|
|
10
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
11
|
+
# Please update as you see appropriate
|
|
12
|
+
{{#models}}
|
|
13
|
+
{{#model}}
|
|
14
|
+
describe {{moduleName}}::{{classname}} do
|
|
15
|
+
{{^oneOf}}
|
|
16
|
+
let(:instance) { {{moduleName}}::{{classname}}.new }
|
|
17
|
+
|
|
18
|
+
describe 'test an instance of {{classname}}' do
|
|
19
|
+
it 'should create an instance of {{classname}}' do
|
|
20
|
+
expect(instance).to be_instance_of({{moduleName}}::{{classname}})
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
{{#vars}}
|
|
24
|
+
describe 'test attribute "{{{name}}}"' do
|
|
25
|
+
it 'should work' do
|
|
26
|
+
{{#isEnum}}
|
|
27
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
28
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
|
|
29
|
+
# validator.allowable_values.each do |value|
|
|
30
|
+
# expect { instance.{{name}} = value }.not_to raise_error
|
|
31
|
+
# end
|
|
32
|
+
{{/isEnum}}
|
|
33
|
+
{{^isEnum}}
|
|
34
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
35
|
+
{{/isEnum}}
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
{{/vars}}
|
|
40
|
+
{{/oneOf}}
|
|
41
|
+
{{#oneOf}}
|
|
42
|
+
{{#-first}}
|
|
43
|
+
describe '.openapi_one_of' do
|
|
44
|
+
it 'lists the items referenced in the oneOf array' do
|
|
45
|
+
expect(described_class.openapi_one_of).to_not be_empty
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
{{#discriminator}}
|
|
50
|
+
{{#propertyName}}
|
|
51
|
+
describe '.openapi_discriminator_name' do
|
|
52
|
+
it 'returns the value of the "discriminator" property' do
|
|
53
|
+
expect(described_class.openapi_discriminator_name).to_not be_empty
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
{{/propertyName}}
|
|
58
|
+
{{#mappedModels}}
|
|
59
|
+
{{#-first}}
|
|
60
|
+
describe '.openapi_discriminator_mapping' do
|
|
61
|
+
it 'returns the key/values of the "mapping" property' do
|
|
62
|
+
expect(described_class.openapi_discriminator_mapping.values.sort).to eq(described_class.openapi_one_of.sort)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
{{/-first}}
|
|
67
|
+
{{/mappedModels}}
|
|
68
|
+
{{/discriminator}}
|
|
69
|
+
describe '.build' do
|
|
70
|
+
it 'returns the correct model' do
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
{{/-first}}
|
|
74
|
+
{{/oneOf}}
|
|
75
|
+
end
|
|
76
|
+
{{/model}}
|
|
77
|
+
{{/models}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class {{classname}}{{#allowableValues}}{{#enumVars}}
|
|
2
|
+
{{{name}}} = {{{value}}}.freeze{{/enumVars}}
|
|
3
|
+
|
|
4
|
+
{{/allowableValues}}
|
|
5
|
+
# Builds the enum from string
|
|
6
|
+
# @param [String] The enum value in the form of the string
|
|
7
|
+
# @return [String] The enum value
|
|
8
|
+
def self.build_from_hash(value)
|
|
9
|
+
new.build_from_hash(value)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Builds the enum from string
|
|
13
|
+
# @param [String] The enum value in the form of the string
|
|
14
|
+
# @return [String] The enum value
|
|
15
|
+
def build_from_hash(value)
|
|
16
|
+
constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value }
|
|
17
|
+
raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty?
|
|
18
|
+
value
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
{{#description}}
|
|
2
|
+
# {{{.}}}
|
|
3
|
+
{{/description}}
|
|
4
|
+
class {{classname}}{{#parent}} < {{{.}}}{{/parent}}
|
|
5
|
+
{{#vars}}
|
|
6
|
+
{{#description}}
|
|
7
|
+
# {{{.}}}
|
|
8
|
+
{{/description}}
|
|
9
|
+
attr_accessor :{{{name}}}
|
|
10
|
+
|
|
11
|
+
{{/vars}}
|
|
12
|
+
{{#hasEnums}}
|
|
13
|
+
class EnumAttributeValidator
|
|
14
|
+
attr_reader :datatype
|
|
15
|
+
attr_reader :allowable_values
|
|
16
|
+
|
|
17
|
+
def initialize(datatype, allowable_values)
|
|
18
|
+
@allowable_values = allowable_values.map do |value|
|
|
19
|
+
case datatype.to_s
|
|
20
|
+
when /Integer/i
|
|
21
|
+
value.to_i
|
|
22
|
+
when /Float/i
|
|
23
|
+
value.to_f
|
|
24
|
+
else
|
|
25
|
+
value
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def valid?(value)
|
|
31
|
+
!value || allowable_values.include?(value)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
{{/hasEnums}}
|
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
|
+
def self.attribute_map
|
|
38
|
+
{
|
|
39
|
+
{{#vars}}
|
|
40
|
+
:'{{{name}}}' => :'{{{baseName}}}'{{^-last}},{{/-last}}
|
|
41
|
+
{{/vars}}
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns all the JSON keys this model knows about{{#parent}}, including the ones defined in its parent(s){{/parent}}
|
|
46
|
+
def self.acceptable_attributes
|
|
47
|
+
{{^parent}}
|
|
48
|
+
attribute_map.values
|
|
49
|
+
{{/parent}}
|
|
50
|
+
{{#parent}}
|
|
51
|
+
attribute_map.values.concat(superclass.acceptable_attributes)
|
|
52
|
+
{{/parent}}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Attribute type mapping.
|
|
56
|
+
def self.openapi_types
|
|
57
|
+
{
|
|
58
|
+
{{#vars}}
|
|
59
|
+
:'{{{name}}}' => :'{{{dataType}}}'{{^-last}},{{/-last}}
|
|
60
|
+
{{/vars}}
|
|
61
|
+
}
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# List of attributes with nullable: true
|
|
65
|
+
def self.openapi_nullable
|
|
66
|
+
Set.new([
|
|
67
|
+
{{#vars}}
|
|
68
|
+
{{#isNullable}}
|
|
69
|
+
:'{{{name}}}'{{^-last}},{{/-last}}
|
|
70
|
+
{{/isNullable}}
|
|
71
|
+
{{/vars}}
|
|
72
|
+
])
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
{{#anyOf}}
|
|
76
|
+
{{#-first}}
|
|
77
|
+
# List of class defined in anyOf (OpenAPI v3)
|
|
78
|
+
def self.openapi_any_of
|
|
79
|
+
[
|
|
80
|
+
{{/-first}}
|
|
81
|
+
:'{{{.}}}'{{^-last}},{{/-last}}
|
|
82
|
+
{{#-last}}
|
|
83
|
+
]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
{{/-last}}
|
|
87
|
+
{{/anyOf}}
|
|
88
|
+
{{#allOf}}
|
|
89
|
+
{{#-first}}
|
|
90
|
+
# List of class defined in allOf (OpenAPI v3)
|
|
91
|
+
def self.openapi_all_of
|
|
92
|
+
[
|
|
93
|
+
{{/-first}}
|
|
94
|
+
:'{{{.}}}'{{^-last}},{{/-last}}
|
|
95
|
+
{{#-last}}
|
|
96
|
+
]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
{{/-last}}
|
|
100
|
+
{{/allOf}}
|
|
101
|
+
{{#discriminator}}
|
|
102
|
+
{{#propertyName}}
|
|
103
|
+
# discriminator's property name in OpenAPI v3
|
|
104
|
+
def self.openapi_discriminator_name
|
|
105
|
+
:'{{{.}}}'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
{{/propertyName}}
|
|
109
|
+
{{/discriminator}}
|
|
110
|
+
# Initializes the object
|
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
112
|
+
def initialize(attributes = {})
|
|
113
|
+
if (!attributes.is_a?(Hash))
|
|
114
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `{{{moduleName}}}::{{{classname}}}` initialize method"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
118
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
119
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
120
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `{{{moduleName}}}::{{{classname}}}`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
121
|
+
end
|
|
122
|
+
h[k.to_sym] = v
|
|
123
|
+
}
|
|
124
|
+
{{#parent}}
|
|
125
|
+
|
|
126
|
+
# call parent's initialize
|
|
127
|
+
super(attributes)
|
|
128
|
+
{{/parent}}
|
|
129
|
+
{{#vars}}
|
|
130
|
+
|
|
131
|
+
if attributes.key?(:'{{{name}}}')
|
|
132
|
+
{{#isArray}}
|
|
133
|
+
if (value = attributes[:'{{{name}}}']).is_a?(Array)
|
|
134
|
+
self.{{{name}}} = value
|
|
135
|
+
end
|
|
136
|
+
{{/isArray}}
|
|
137
|
+
{{#isMap}}
|
|
138
|
+
if (value = attributes[:'{{{name}}}']).is_a?(Hash)
|
|
139
|
+
self.{{{name}}} = value
|
|
140
|
+
end
|
|
141
|
+
{{/isMap}}
|
|
142
|
+
{{^isContainer}}
|
|
143
|
+
self.{{{name}}} = attributes[:'{{{name}}}']
|
|
144
|
+
{{/isContainer}}
|
|
145
|
+
{{#defaultValue}}
|
|
146
|
+
else
|
|
147
|
+
self.{{{name}}} = {{{defaultValue}}}
|
|
148
|
+
{{/defaultValue}}
|
|
149
|
+
end
|
|
150
|
+
{{/vars}}
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
154
|
+
# @return Array for valid properties with the reasons
|
|
155
|
+
def list_invalid_properties
|
|
156
|
+
invalid_properties = {{^parent}}Array.new{{/parent}}{{#parent}}super{{/parent}}
|
|
157
|
+
{{#vars}}
|
|
158
|
+
{{^isNullable}}
|
|
159
|
+
{{#required}}
|
|
160
|
+
if @{{{name}}}.nil?
|
|
161
|
+
invalid_properties.push('invalid value for "{{{name}}}", {{{name}}} cannot be nil.')
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
{{/required}}
|
|
165
|
+
{{/isNullable}}
|
|
166
|
+
{{#hasValidation}}
|
|
167
|
+
{{#maxLength}}
|
|
168
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
|
|
169
|
+
invalid_properties.push('invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
{{/maxLength}}
|
|
173
|
+
{{#minLength}}
|
|
174
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
|
|
175
|
+
invalid_properties.push('invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.')
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
{{/minLength}}
|
|
179
|
+
{{#maximum}}
|
|
180
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
|
|
181
|
+
invalid_properties.push('invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.')
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
{{/maximum}}
|
|
185
|
+
{{#minimum}}
|
|
186
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
|
|
187
|
+
invalid_properties.push('invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
{{/minimum}}
|
|
191
|
+
{{#pattern}}
|
|
192
|
+
pattern = Regexp.new({{{pattern}}})
|
|
193
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ pattern
|
|
194
|
+
invalid_properties.push("invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}.")
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
{{/pattern}}
|
|
198
|
+
{{#maxItems}}
|
|
199
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
|
|
200
|
+
invalid_properties.push('invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.')
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
{{/maxItems}}
|
|
204
|
+
{{#minItems}}
|
|
205
|
+
if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
|
|
206
|
+
invalid_properties.push('invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.')
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
{{/minItems}}
|
|
210
|
+
{{/hasValidation}}
|
|
211
|
+
{{/vars}}
|
|
212
|
+
invalid_properties
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Check to see if the all the properties in the model are valid
|
|
216
|
+
# @return true if the model is valid
|
|
217
|
+
def valid?
|
|
218
|
+
{{#vars}}
|
|
219
|
+
{{^isNullable}}
|
|
220
|
+
{{#required}}
|
|
221
|
+
return false if @{{{name}}}.nil?
|
|
222
|
+
{{/required}}
|
|
223
|
+
{{/isNullable}}
|
|
224
|
+
{{#isEnum}}
|
|
225
|
+
{{^isContainer}}
|
|
226
|
+
{{{name}}}_validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
|
|
227
|
+
return false unless {{{name}}}_validator.valid?(@{{{name}}})
|
|
228
|
+
{{/isContainer}}
|
|
229
|
+
{{/isEnum}}
|
|
230
|
+
{{#hasValidation}}
|
|
231
|
+
{{#maxLength}}
|
|
232
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}}
|
|
233
|
+
{{/maxLength}}
|
|
234
|
+
{{#minLength}}
|
|
235
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length < {{{minLength}}}
|
|
236
|
+
{{/minLength}}
|
|
237
|
+
{{#maximum}}
|
|
238
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
|
|
239
|
+
{{/maximum}}
|
|
240
|
+
{{#minimum}}
|
|
241
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
|
|
242
|
+
{{/minimum}}
|
|
243
|
+
{{#pattern}}
|
|
244
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}} !~ Regexp.new({{{pattern}}})
|
|
245
|
+
{{/pattern}}
|
|
246
|
+
{{#maxItems}}
|
|
247
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length > {{{maxItems}}}
|
|
248
|
+
{{/maxItems}}
|
|
249
|
+
{{#minItems}}
|
|
250
|
+
return false if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.length < {{{minItems}}}
|
|
251
|
+
{{/minItems}}
|
|
252
|
+
{{/hasValidation}}
|
|
253
|
+
{{/vars}}
|
|
254
|
+
{{#anyOf}}
|
|
255
|
+
{{#-first}}
|
|
256
|
+
_any_of_found = false
|
|
257
|
+
self.class.openapi_any_of.each do |_class|
|
|
258
|
+
_any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
|
|
259
|
+
if _any_of.valid?
|
|
260
|
+
_any_of_found = true
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
if !_any_of_found
|
|
265
|
+
return false
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
{{/-first}}
|
|
269
|
+
{{/anyOf}}
|
|
270
|
+
true{{#parent}} && super{{/parent}}
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
{{#vars}}
|
|
274
|
+
{{#isEnum}}
|
|
275
|
+
{{^isContainer}}
|
|
276
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
277
|
+
# @param [Object] {{{name}}} Object to be assigned
|
|
278
|
+
def {{{name}}}=({{{name}}})
|
|
279
|
+
validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#enumVars}}{{{value}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}])
|
|
280
|
+
unless validator.valid?({{{name}}})
|
|
281
|
+
fail ArgumentError, "invalid value for \"{{{name}}}\", must be one of #{validator.allowable_values}."
|
|
282
|
+
end
|
|
283
|
+
@{{{name}}} = {{{name}}}
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
{{/isContainer}}
|
|
287
|
+
{{/isEnum}}
|
|
288
|
+
{{^isEnum}}
|
|
289
|
+
{{#hasValidation}}
|
|
290
|
+
# Custom attribute writer method with validation
|
|
291
|
+
# @param [Object] {{{name}}} Value to be assigned
|
|
292
|
+
def {{{name}}}=({{{name}}})
|
|
293
|
+
{{^isNullable}}
|
|
294
|
+
{{#required}}
|
|
295
|
+
if {{{name}}}.nil?
|
|
296
|
+
fail ArgumentError, '{{{name}}} cannot be nil'
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
{{/required}}
|
|
300
|
+
{{/isNullable}}
|
|
301
|
+
{{#maxLength}}
|
|
302
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length > {{{maxLength}}}
|
|
303
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.'
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
{{/maxLength}}
|
|
307
|
+
{{#minLength}}
|
|
308
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length < {{{minLength}}}
|
|
309
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be great than or equal to {{{minLength}}}.'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
{{/minLength}}
|
|
313
|
+
{{#maximum}}
|
|
314
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{{maximum}}}
|
|
315
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{{maximum}}}.'
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
{{/maximum}}
|
|
319
|
+
{{#minimum}}
|
|
320
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{{minimum}}}
|
|
321
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", must be greater than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{{minimum}}}.'
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
{{/minimum}}
|
|
325
|
+
{{#pattern}}
|
|
326
|
+
pattern = Regexp.new({{{pattern}}})
|
|
327
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}} !~ pattern
|
|
328
|
+
fail ArgumentError, "invalid value for \"{{{name}}}\", must conform to the pattern #{pattern}."
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
{{/pattern}}
|
|
332
|
+
{{#maxItems}}
|
|
333
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length > {{{maxItems}}}
|
|
334
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be less than or equal to {{{maxItems}}}.'
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
{{/maxItems}}
|
|
338
|
+
{{#minItems}}
|
|
339
|
+
if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.length < {{{minItems}}}
|
|
340
|
+
fail ArgumentError, 'invalid value for "{{{name}}}", number of items must be greater than or equal to {{{minItems}}}.'
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
{{/minItems}}
|
|
344
|
+
@{{{name}}} = {{{name}}}
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
{{/hasValidation}}
|
|
348
|
+
{{/isEnum}}
|
|
349
|
+
{{/vars}}
|
|
350
|
+
# Checks equality by comparing each attribute.
|
|
351
|
+
# @param [Object] Object to be compared
|
|
352
|
+
def ==(o)
|
|
353
|
+
return true if self.equal?(o)
|
|
354
|
+
self.class == o.class{{#vars}} &&
|
|
355
|
+
{{name}} == o.{{name}}{{/vars}}{{#parent}} && super(o){{/parent}}
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
# @see the `==` method
|
|
359
|
+
# @param [Object] Object to be compared
|
|
360
|
+
def eql?(o)
|
|
361
|
+
self == o
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
# Calculates hash code according to all attributes.
|
|
365
|
+
# @return [Integer] Hash code
|
|
366
|
+
def hash
|
|
367
|
+
[{{#vars}}{{name}}{{^-last}}, {{/-last}}{{/vars}}].hash
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
{{> base_object}}
|
|
371
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# {{moduleName}}::{{classname}}
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
| Name | Type | Description | Notes |
|
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
|
7
|
+
{{#vars}}
|
|
8
|
+
| **{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{.}}]{{/defaultValue}} |
|
|
9
|
+
{{/vars}}
|
|
10
|
+
|
|
11
|
+
## Example
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require '{{{gemName}}}'
|
|
15
|
+
|
|
16
|
+
{{^vars}}
|
|
17
|
+
instance = {{moduleName}}::{{classname}}.new()
|
|
18
|
+
{{/vars}}
|
|
19
|
+
{{#vars}}
|
|
20
|
+
{{#-first}}
|
|
21
|
+
instance = {{moduleName}}::{{classname}}.new(
|
|
22
|
+
{{/-first}}
|
|
23
|
+
{{name}}: {{example}}{{^-last}},{{/-last}}
|
|
24
|
+
{{#-last}}
|
|
25
|
+
)
|
|
26
|
+
{{/-last}}
|
|
27
|
+
{{/vars}}
|
|
28
|
+
```
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
{{#description}}
|
|
2
|
+
# {{{.}}}
|
|
3
|
+
{{/description}}
|
|
4
|
+
module {{classname}}
|
|
5
|
+
class << self
|
|
6
|
+
{{#oneOf}}
|
|
7
|
+
{{#-first}}
|
|
8
|
+
# List of class defined in oneOf (OpenAPI v3)
|
|
9
|
+
def openapi_one_of
|
|
10
|
+
[
|
|
11
|
+
{{/-first}}
|
|
12
|
+
:'{{{.}}}'{{^-last}},{{/-last}}
|
|
13
|
+
{{#-last}}
|
|
14
|
+
]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
{{/-last}}
|
|
18
|
+
{{/oneOf}}
|
|
19
|
+
{{#discriminator}}
|
|
20
|
+
{{#propertyName}}
|
|
21
|
+
# Discriminator's property name (OpenAPI v3)
|
|
22
|
+
def openapi_discriminator_name
|
|
23
|
+
:'{{{.}}}'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
{{/propertyName}}
|
|
27
|
+
{{#mappedModels}}
|
|
28
|
+
{{#-first}}
|
|
29
|
+
# Discriminator's mapping (OpenAPI v3)
|
|
30
|
+
def openapi_discriminator_mapping
|
|
31
|
+
{
|
|
32
|
+
{{/-first}}
|
|
33
|
+
:'{{{mappingName}}}' => :'{{{modelName}}}'{{^-last}},{{/-last}}
|
|
34
|
+
{{#-last}}
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
{{/-last}}
|
|
39
|
+
{{/mappedModels}}
|
|
40
|
+
{{/discriminator}}
|
|
41
|
+
# Builds the object
|
|
42
|
+
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
43
|
+
# @return [Object] Returns the model or the data itself
|
|
44
|
+
def build(data)
|
|
45
|
+
{{#discriminator}}
|
|
46
|
+
discriminator_value = data[openapi_discriminator_name]
|
|
47
|
+
return nil unless discriminator_value
|
|
48
|
+
{{#mappedModels}}
|
|
49
|
+
{{#-first}}
|
|
50
|
+
|
|
51
|
+
klass = openapi_discriminator_mapping[discriminator_value.to_sym]
|
|
52
|
+
return nil unless klass
|
|
53
|
+
|
|
54
|
+
{{moduleName}}.const_get(klass).build_from_hash(data)
|
|
55
|
+
{{/-first}}
|
|
56
|
+
{{/mappedModels}}
|
|
57
|
+
{{^mappedModels}}
|
|
58
|
+
{{moduleName}}.const_get(discriminator_value).build_from_hash(data)
|
|
59
|
+
{{/mappedModels}}
|
|
60
|
+
{{/discriminator}}
|
|
61
|
+
{{^discriminator}}
|
|
62
|
+
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
63
|
+
# Note:
|
|
64
|
+
# - We do not attempt to check whether exactly one item matches.
|
|
65
|
+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
66
|
+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
67
|
+
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
68
|
+
# - TODO: logging when debugging is set.
|
|
69
|
+
openapi_one_of.each do |klass|
|
|
70
|
+
begin
|
|
71
|
+
next if klass == :AnyType # "nullable: true"
|
|
72
|
+
typed_data = find_and_cast_into_type(klass, data)
|
|
73
|
+
return typed_data if typed_data
|
|
74
|
+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
openapi_one_of.include?(:AnyType) ? data : nil
|
|
79
|
+
{{/discriminator}}
|
|
80
|
+
end
|
|
81
|
+
{{^discriminator}}
|
|
82
|
+
|
|
83
|
+
private
|
|
84
|
+
|
|
85
|
+
SchemaMismatchError = Class.new(StandardError)
|
|
86
|
+
|
|
87
|
+
# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
88
|
+
def find_and_cast_into_type(klass, data)
|
|
89
|
+
return if data.nil?
|
|
90
|
+
|
|
91
|
+
case klass.to_s
|
|
92
|
+
when 'Boolean'
|
|
93
|
+
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
94
|
+
when 'Float'
|
|
95
|
+
return data if data.instance_of?(Float)
|
|
96
|
+
when 'Integer'
|
|
97
|
+
return data if data.instance_of?(Integer)
|
|
98
|
+
when 'Time'
|
|
99
|
+
return Time.parse(data)
|
|
100
|
+
when 'Date'
|
|
101
|
+
return Date.parse(data)
|
|
102
|
+
when 'String'
|
|
103
|
+
return data if data.instance_of?(String)
|
|
104
|
+
when 'Object' # "type: object"
|
|
105
|
+
return data if data.instance_of?(Hash)
|
|
106
|
+
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
107
|
+
if data.instance_of?(Array)
|
|
108
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
109
|
+
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
110
|
+
end
|
|
111
|
+
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
112
|
+
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
113
|
+
sub_type = Regexp.last_match[:sub_type]
|
|
114
|
+
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
115
|
+
end
|
|
116
|
+
else # model
|
|
117
|
+
const = {{moduleName}}.const_get(klass)
|
|
118
|
+
if const
|
|
119
|
+
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
120
|
+
model = const.build(data)
|
|
121
|
+
return model if model
|
|
122
|
+
else
|
|
123
|
+
# raise if data contains keys that are not known to the model
|
|
124
|
+
raise unless (data.keys - const.acceptable_attributes).empty?
|
|
125
|
+
model = const.build_from_hash(data)
|
|
126
|
+
return model if model && model.valid?
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
raise # if no match by now, raise
|
|
132
|
+
rescue
|
|
133
|
+
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
134
|
+
end
|
|
135
|
+
{{/discriminator}}
|
|
136
|
+
end
|
|
137
|
+
end
|