@@ -56,8 +56,8 @@ public void CreatesCollectionResponseSchema(bool enablePagination, bool enableCo
56
56
var schemas = context . CreateSchemas ( ) ;
57
57
58
58
var stringCollectionResponse = schemas [ "StringCollectionResponse" ] ;
59
- var flightCollectionResponse = schemas [ "Microsoft.OData.Service.Sample.TrippinInMemory.Models.FlightCollectionResponse" ] ;
60
-
59
+ var flightCollectionResponse = schemas [ "Microsoft.OData.Service.Sample.TrippinInMemory.Models.FlightCollectionResponse" ] ;
60
+
61
61
if ( enablePagination || enableCount )
62
62
{
63
63
Assert . Collection ( stringCollectionResponse . AllOf ,
@@ -79,7 +79,7 @@ public void CreatesCollectionResponseSchema(bool enablePagination, bool enableCo
79
79
Assert . Equal ( "array" , stringCollectionResponse . Properties [ "value" ] . Type ) ;
80
80
Assert . Equal ( "array" , flightCollectionResponse . Properties [ "value" ] . Type ) ;
81
81
Assert . Equal ( "Microsoft.OData.Service.Sample.TrippinInMemory.Models.Flight" , flightCollectionResponse . Properties [ "value" ] . Items . Reference . Id ) ;
82
- }
82
+ }
83
83
}
84
84
85
85
[ Fact ]
@@ -903,7 +903,7 @@ public void CreatePropertySchemaForNullableEnumPropertyReturnSchema(OpenApiSpecV
903
903
Assert . NotNull ( schema ) ;
904
904
string json = schema . SerializeAsJson ( specVersion ) ;
905
905
_output . WriteLine ( json ) ;
906
-
906
+
907
907
// Assert
908
908
if ( specVersion == OpenApiSpecVersion . OpenApi2_0 )
909
909
{
@@ -956,7 +956,7 @@ public void CreatePropertySchemaWithComputedAnnotationReturnsCorrectSchema(OpenA
956
956
""pattern"": ""^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+([.][0-9]+)?S)?)?$"",
957
957
""type"": ""string"",
958
958
""readOnly"": true
959
- }" . ChangeLineBreaks ( ) , json ) ;
959
+ }" . ChangeLineBreaks ( ) , json ) ;
960
960
}
961
961
else
962
962
{
@@ -1117,5 +1117,26 @@ public void NonNullableDoublePropertyWithDefaultStringWorks()
1117
1117
""default"": ""3.1415926535897931""
1118
1118
}" . ChangeLineBreaks ( ) , json ) ;
1119
1119
}
1120
+
1121
+
1122
+ [ Fact ]
1123
+ public void NonNullableUntypedPropertyWorks ( )
1124
+ {
1125
+ ODataContext context = new ODataContext ( EdmModelHelper . BasicEdmModel ) ;
1126
+ EdmEntityType entitType = new EdmEntityType ( "NS" , "Entity" ) ;
1127
+ IEdmStructuralProperty property = new EdmStructuralProperty (
1128
+ entitType , "UntypedProperty" , EdmCoreModel . Instance . GetUntyped ( ) ) ;
1129
+
1130
+ // Act
1131
+ var schema = context . CreatePropertySchema ( property ) ;
1132
+
1133
+ // Assert
1134
+ Assert . NotNull ( schema ) ;
1135
+ Assert . Null ( schema . Type ) ;
1136
+
1137
+ string json = schema . SerializeAsJson ( OpenApiSpecVersion . OpenApi3_0 ) ;
1138
+
1139
+ Assert . Equal ( "{ }" , json ) ;
1140
+ }
1120
1141
}
1121
1142
}
0 commit comments