@@ -42,15 +42,19 @@ public async Task Guid_type_produces_expected_schema(string modelName)
42
42
43
43
[ Theory ]
44
44
[ MemberData ( nameof ( ModelNames ) ) ]
45
- public async Task Length_annotation_on_resource_property_produces_expected_schema ( string modelName )
45
+ public async Task Length_annotation_on_resource_string_property_produces_expected_schema ( string modelName )
46
46
{
47
47
// Act
48
48
JsonElement document = await _testContext . GetSwaggerDocumentAsync ( ) ;
49
49
50
50
// Assert
51
- document . Should ( ) . ContainPath ( $ "components.schemas.{ modelName } .properties.firstName") . With ( firstName =>
51
+ document . Should ( ) . ContainPath ( $ "components.schemas.{ modelName } .properties.firstName") . With ( firstNameElement =>
52
52
{
53
- firstName . Should ( ) . HaveProperty ( "type" , "string" ) ;
53
+ #if ! NET6_0
54
+ firstNameElement . Should ( ) . HaveProperty ( "maxLength" , 20 ) ;
55
+ firstNameElement . Should ( ) . HaveProperty ( "minLength" , 2 ) ;
56
+ #endif
57
+ firstNameElement . Should ( ) . HaveProperty ( "type" , "string" ) ;
54
58
} ) ;
55
59
}
56
60
@@ -224,14 +228,18 @@ public async Task Uri_type_produces_expected_schema(string modelName)
224
228
225
229
[ Theory ]
226
230
[ MemberData ( nameof ( ModelNames ) ) ]
227
- public async Task HashSet_type_produces_expected_schema ( string modelName )
231
+ public async Task Length_annotation_on_resource_list_property_produces_expected_schema ( string modelName )
228
232
{
229
233
// Act
230
234
JsonElement document = await _testContext . GetSwaggerDocumentAsync ( ) ;
231
235
232
236
// Assert
233
237
document . Should ( ) . ContainPath ( $ "components.schemas.{ modelName } .properties.tags") . With ( tagsElement =>
234
238
{
239
+ #if ! NET6_0
240
+ tagsElement . Should ( ) . HaveProperty ( "maxItems" , 10 ) ;
241
+ tagsElement . Should ( ) . HaveProperty ( "minItems" , 1 ) ;
242
+ #endif
235
243
tagsElement . Should ( ) . HaveProperty ( "type" , "array" ) ;
236
244
tagsElement . Should ( ) . ContainPath ( "items" ) . With ( itemsEl =>
237
245
{
@@ -242,7 +250,21 @@ public async Task HashSet_type_produces_expected_schema(string modelName)
242
250
243
251
[ Theory ]
244
252
[ MemberData ( nameof ( ModelNames ) ) ]
245
- public async Task Allowed_denied_annotations_on_resource_property_produces_expected_schema ( string modelName )
253
+ public async Task AllowedValues_annotation_on_resource_list_property_produces_expected_schema ( string modelName )
254
+ {
255
+ // Act
256
+ JsonElement document = await _testContext . GetSwaggerDocumentAsync ( ) ;
257
+
258
+ // Assert
259
+ document . Should ( ) . ContainPath ( $ "components.schemas.{ modelName } .properties.countryCode") . With ( countryCodeElement =>
260
+ {
261
+ countryCodeElement . Should ( ) . HaveProperty ( "type" , "string" ) ;
262
+ } ) ;
263
+ }
264
+
265
+ [ Theory ]
266
+ [ MemberData ( nameof ( ModelNames ) ) ]
267
+ public async Task DeniedValues_annotation_on_resource_property_produces_expected_schema ( string modelName )
246
268
{
247
269
// Act
248
270
JsonElement document = await _testContext . GetSwaggerDocumentAsync ( ) ;
0 commit comments