File tree 2 files changed +16
-8
lines changed
2 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -790,7 +790,7 @@ def t_schema(
790
790
if not origin :
791
791
return None
792
792
if isinstance (origin , dict ) and _is_type_dict_str_any (origin ):
793
- process_schema (origin , client , order_properties = False )
793
+ process_schema (origin , client )
794
794
return types .Schema .model_validate (origin )
795
795
if isinstance (origin , EnumMeta ):
796
796
return _process_enum (origin , client )
@@ -799,7 +799,7 @@ def t_schema(
799
799
# response_schema value was coerced to an empty Schema instance because it did not adhere to the Schema field annotation
800
800
raise ValueError (f'Unsupported schema type.' )
801
801
schema = origin .model_dump (exclude_unset = True )
802
- process_schema (schema , client , order_properties = False )
802
+ process_schema (schema , client )
803
803
return types .Schema .model_validate (schema )
804
804
805
805
if (
Original file line number Diff line number Diff line change @@ -605,17 +605,25 @@ def test_t_schema_does_not_change_property_ordering_if_set(client):
605
605
assert transformed_schema .property_ordering == custom_property_ordering
606
606
607
607
608
- def test_t_schema_does_not_set_property_ordering_for_json_schema (client ):
609
- """Tests t_schema doesn't set the property_ordering field for json schemas."""
608
+ def test_t_schema_sets_property_ordering_for_json_schema (client ):
609
+ """Tests t_schema sets the property_ordering field for json schemas."""
610
610
611
611
schema = CountryInfo .model_json_schema ()
612
612
613
613
transformed_schema = _transformers .t_schema (client , schema )
614
- assert transformed_schema .property_ordering is None
614
+ assert transformed_schema .property_ordering == [
615
+ 'name' ,
616
+ 'population' ,
617
+ 'capital' ,
618
+ 'continent' ,
619
+ 'gdp' ,
620
+ 'official_language' ,
621
+ 'total_area_sq_mi' ,
622
+ ]
615
623
616
624
617
- def test_t_schema_does_not_set_property_ordering_for_schema_type (client ):
618
- """Tests t_schema doesn't set the property_ordering field for Schema types."""
625
+ def test_t_schema_sets_property_ordering_for_schema_type (client ):
626
+ """Tests t_schema sets the property_ordering field for Schema types."""
619
627
620
628
schema = types .Schema (
621
629
properties = {
@@ -635,4 +643,4 @@ def test_t_schema_does_not_set_property_ordering_for_schema_type(client):
635
643
)
636
644
637
645
transformed_schema = _transformers .t_schema (client , schema )
638
- assert transformed_schema .property_ordering is None
646
+ assert transformed_schema .property_ordering == [ 'name' , 'population' ]
You can’t perform that action at this time.
0 commit comments