@@ -241,7 +241,7 @@ def string_property(**kwargs) -> StringProperty:
241
241
242
242
243
243
class TestProcessProperties :
244
- def test_conflicting_properties (self , model_property ):
244
+ def test_conflicting_properties_different_types (self , model_property ):
245
245
from openapi_python_client .parser .properties import Schemas
246
246
from openapi_python_client .parser .properties .model_property import _process_properties
247
247
@@ -261,6 +261,22 @@ def test_conflicting_properties(self, model_property):
261
261
262
262
assert isinstance (result , PropertyError )
263
263
264
+ def test_conflicting_properties_same_types (self , model_property ):
265
+ from openapi_python_client .parser .properties import Schemas
266
+ from openapi_python_client .parser .properties .model_property import _process_properties
267
+
268
+ data = oai .Schema .construct (allOf = [oai .Reference .construct (ref = "First" ), oai .Reference .construct (ref = "Second" )])
269
+ schemas = Schemas (
270
+ models = {
271
+ "First" : model_property (optional_properties = [string_property (default = "abc" )]),
272
+ "Second" : model_property (optional_properties = [string_property ()]),
273
+ }
274
+ )
275
+
276
+ result = _process_properties (data = data , schemas = schemas , class_name = "" )
277
+
278
+ assert isinstance (result , PropertyError )
279
+
264
280
def test_duplicate_properties (self , model_property ):
265
281
from openapi_python_client .parser .properties import Schemas
266
282
from openapi_python_client .parser .properties .model_property import _process_properties
@@ -311,3 +327,25 @@ def test_mixed_requirements(self, model_property, first_nullable, second_nullabl
311
327
assert result .optional_props == [expected_prop ]
312
328
else :
313
329
assert result .required_props == [expected_prop ]
330
+
331
+ def test_direct_properties_non_ref (self ):
332
+ from openapi_python_client .parser .properties import Schemas
333
+ from openapi_python_client .parser .properties .model_property import _process_properties
334
+
335
+ data = oai .Schema .construct (
336
+ allOf = [
337
+ oai .Schema .construct (
338
+ required = ["first" ],
339
+ properties = {
340
+ "first" : oai .Schema .construct (type = "string" ),
341
+ "second" : oai .Schema .construct (type = "string" ),
342
+ },
343
+ )
344
+ ]
345
+ )
346
+ schemas = Schemas ()
347
+
348
+ result = _process_properties (data = data , schemas = schemas , class_name = "" )
349
+
350
+ assert result .optional_props == [string_property (name = "second" , required = False , nullable = False )]
351
+ assert result .required_props == [string_property (name = "first" , required = True , nullable = False )]
0 commit comments