@@ -33,7 +33,7 @@ def lazy_import():
33
33
globals ()['ContactDetailsResponse' ] = ContactDetailsResponse
34
34
35
35
36
- class ContactListResponse (ModelSimple ):
36
+ class ContactListResponse (ModelNormal ):
37
37
"""NOTE: This class is auto generated by OpenAPI Generator.
38
38
Ref: https://openapi-generator.tech
39
39
@@ -44,6 +44,10 @@ class ContactListResponse(ModelSimple):
44
44
and the for var_name this is (var_name,). The value is a dict
45
45
with a capitalized key describing the allowed value and an allowed
46
46
value. These dicts store the allowed enum values.
47
+ attribute_map (dict): The key is attribute name
48
+ and the value is json key in definition.
49
+ discriminator_value_class_map (dict): A dict to go from the discriminator
50
+ variable value to the discriminator class name.
47
51
validations (dict): The key is the tuple path to the attribute
48
52
and the for var_name this is (var_name,). The value is a dict
49
53
that stores validations for max_length, min_length, max_items,
@@ -59,7 +63,14 @@ class ContactListResponse(ModelSimple):
59
63
validations = {
60
64
}
61
65
62
- additional_properties_type = None
66
+ @cached_property
67
+ def additional_properties_type ():
68
+ """
69
+ This must be a method because a model may have properties that are
70
+ of type self, this must run after the class is loaded
71
+ """
72
+ lazy_import ()
73
+ return (bool , date , datetime , dict , float , int , list , str , none_type ,) # noqa: E501
63
74
64
75
_nullable = False
65
76
@@ -75,40 +86,29 @@ def openapi_types():
75
86
"""
76
87
lazy_import ()
77
88
return {
78
- 'value ' : ([ContactDetailsResponse ],),
89
+ 'results ' : ([ContactDetailsResponse ],), # noqa: E501
79
90
}
80
91
81
92
@cached_property
82
93
def discriminator ():
83
94
return None
84
95
85
96
86
- attribute_map = {}
87
-
88
- read_only_vars = set ()
97
+ attribute_map = {
98
+ 'results' : 'results' , # noqa: E501
99
+ }
89
100
90
- _composed_schemas = None
101
+ read_only_vars = {
102
+ }
91
103
92
- required_properties = set ([
93
- '_data_store' ,
94
- '_check_type' ,
95
- '_spec_property_naming' ,
96
- '_path_to_item' ,
97
- '_configuration' ,
98
- '_visited_composed_classes' ,
99
- ])
104
+ _composed_schemas = {}
100
105
106
+ @classmethod
101
107
@convert_js_args_to_python_args
102
- def __init__ ( self , * args , ** kwargs ):
108
+ def _from_openapi_data ( cls , * args , ** kwargs ): # noqa: E501
103
109
"""ContactListResponse - a model defined in OpenAPI
104
110
105
- Note that value can be passed either in args or in kwargs, but not in both.
106
-
107
- Args:
108
- args[0] ([ContactDetailsResponse]): # noqa: E501
109
-
110
111
Keyword Args:
111
- value ([ContactDetailsResponse]): # noqa: E501
112
112
_check_type (bool): if True, values for parameters in openapi_types
113
113
will be type checked and a TypeError will be
114
114
raised if the wrong type is input.
@@ -139,27 +139,17 @@ def __init__(self, *args, **kwargs):
139
139
Animal class but this time we won't travel
140
140
through its discriminator because we passed in
141
141
_visited_composed_classes = (Animal,)
142
+ results ([ContactDetailsResponse]): [optional] # noqa: E501
142
143
"""
143
- # required up here when default value is not given
144
- _path_to_item = kwargs .pop ('_path_to_item' , ())
145
-
146
- if 'value' in kwargs :
147
- value = kwargs .pop ('value' )
148
- elif args :
149
- args = list (args )
150
- value = args .pop (0 )
151
- else :
152
- raise ApiTypeError (
153
- "value is required, but not passed in args or kwargs and doesn't have default" ,
154
- path_to_item = _path_to_item ,
155
- valid_classes = (self .__class__ ,),
156
- )
157
144
158
145
_check_type = kwargs .pop ('_check_type' , True )
159
146
_spec_property_naming = kwargs .pop ('_spec_property_naming' , False )
147
+ _path_to_item = kwargs .pop ('_path_to_item' , ())
160
148
_configuration = kwargs .pop ('_configuration' , None )
161
149
_visited_composed_classes = kwargs .pop ('_visited_composed_classes' , ())
162
150
151
+ self = super (OpenApiModel , cls ).__new__ (cls )
152
+
163
153
if args :
164
154
raise ApiTypeError (
165
155
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
@@ -176,29 +166,31 @@ def __init__(self, *args, **kwargs):
176
166
self ._path_to_item = _path_to_item
177
167
self ._configuration = _configuration
178
168
self ._visited_composed_classes = _visited_composed_classes + (self .__class__ ,)
179
- self .value = value
180
- if kwargs :
181
- raise ApiTypeError (
182
- "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
183
- kwargs ,
184
- self .__class__ .__name__ ,
185
- ),
186
- path_to_item = _path_to_item ,
187
- valid_classes = (self .__class__ ,),
188
- )
189
169
190
- @classmethod
191
- @convert_js_args_to_python_args
192
- def _from_openapi_data (cls , * args , ** kwargs ):
193
- """ContactListResponse - a model defined in OpenAPI
170
+ for var_name , var_value in kwargs .items ():
171
+ if var_name not in self .attribute_map and \
172
+ self ._configuration is not None and \
173
+ self ._configuration .discard_unknown_keys and \
174
+ self .additional_properties_type is None :
175
+ # discard variable.
176
+ continue
177
+ setattr (self , var_name , var_value )
178
+ return self
194
179
195
- Note that value can be passed either in args or in kwargs, but not in both.
180
+ required_properties = set ([
181
+ '_data_store' ,
182
+ '_check_type' ,
183
+ '_spec_property_naming' ,
184
+ '_path_to_item' ,
185
+ '_configuration' ,
186
+ '_visited_composed_classes' ,
187
+ ])
196
188
197
- Args:
198
- args[0] ([ContactDetailsResponse]): # noqa: E501
189
+ @convert_js_args_to_python_args
190
+ def __init__ (self , * args , ** kwargs ): # noqa: E501
191
+ """ContactListResponse - a model defined in OpenAPI
199
192
200
193
Keyword Args:
201
- value ([ContactDetailsResponse]): # noqa: E501
202
194
_check_type (bool): if True, values for parameters in openapi_types
203
195
will be type checked and a TypeError will be
204
196
raised if the wrong type is input.
@@ -229,26 +221,12 @@ def _from_openapi_data(cls, *args, **kwargs):
229
221
Animal class but this time we won't travel
230
222
through its discriminator because we passed in
231
223
_visited_composed_classes = (Animal,)
224
+ results ([ContactDetailsResponse]): [optional] # noqa: E501
232
225
"""
233
- # required up here when default value is not given
234
- _path_to_item = kwargs .pop ('_path_to_item' , ())
235
-
236
- self = super (OpenApiModel , cls ).__new__ (cls )
237
-
238
- if 'value' in kwargs :
239
- value = kwargs .pop ('value' )
240
- elif args :
241
- args = list (args )
242
- value = args .pop (0 )
243
- else :
244
- raise ApiTypeError (
245
- "value is required, but not passed in args or kwargs and doesn't have default" ,
246
- path_to_item = _path_to_item ,
247
- valid_classes = (self .__class__ ,),
248
- )
249
226
250
227
_check_type = kwargs .pop ('_check_type' , True )
251
228
_spec_property_naming = kwargs .pop ('_spec_property_naming' , False )
229
+ _path_to_item = kwargs .pop ('_path_to_item' , ())
252
230
_configuration = kwargs .pop ('_configuration' , None )
253
231
_visited_composed_classes = kwargs .pop ('_visited_composed_classes' , ())
254
232
@@ -268,15 +246,15 @@ def _from_openapi_data(cls, *args, **kwargs):
268
246
self ._path_to_item = _path_to_item
269
247
self ._configuration = _configuration
270
248
self ._visited_composed_classes = _visited_composed_classes + (self .__class__ ,)
271
- self .value = value
272
- if kwargs :
273
- raise ApiTypeError (
274
- "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % (
275
- kwargs ,
276
- self .__class__ .__name__ ,
277
- ),
278
- path_to_item = _path_to_item ,
279
- valid_classes = (self .__class__ ,),
280
- )
281
249
282
- return self
250
+ for var_name , var_value in kwargs .items ():
251
+ if var_name not in self .attribute_map and \
252
+ self ._configuration is not None and \
253
+ self ._configuration .discard_unknown_keys and \
254
+ self .additional_properties_type is None :
255
+ # discard variable.
256
+ continue
257
+ setattr (self , var_name , var_value )
258
+ if var_name in self .read_only_vars :
259
+ raise ApiAttributeError (f"`{ var_name } ` is a read-only attribute. Use `from_openapi_data` to instantiate "
260
+ f"class with read only attributes." )
0 commit comments