@@ -337,13 +337,26 @@ public void GetSwagger_GenerateConsumesSchemas_ForProvidedOpenApiOperationAndApp
337337 Assert . NotNull ( content . Value . Schema . Reference ) ;
338338 Assert . Equal ( "TestDto" , content . Value . Schema . Reference . Id ) ;
339339 Assert . Equal ( 2 , operation . RequestBody . Extensions . Count ) ;
340+
341+ #if NET10_0_OR_GREATER
340342 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
341343 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
344+ #else
345+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-foo" ] ) . Value ) ;
346+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-docName" ] ) . Value ) ;
347+ #endif
348+
342349 Assert . NotEmpty ( operation . Parameters ) ;
343350 Assert . Equal ( "paramQuery" , operation . Parameters [ 0 ] . Name ) ;
344351 Assert . Equal ( 2 , operation . Parameters [ 0 ] . Extensions . Count ) ;
352+
353+ #if NET10_0_OR_GREATER
345354 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
346355 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
356+ #else
357+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Value ) ;
358+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Value ) ;
359+ #endif
347360 }
348361
349362 [ Fact ]
@@ -397,7 +410,7 @@ public void GetSwagger_GenerateParametersSchemas_ForProvidedOpenApiOperation()
397410 Assert . Equal ( "OperationIdSetInMetadata" , document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . OperationId ) ;
398411 Assert . Equal ( "ParameterInMetadata" , document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . Parameters [ 0 ] . Name ) ;
399412 Assert . NotNull ( document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . Parameters [ 0 ] . Schema ) ;
400- Assert . Equal ( JsonSchemaType . String , document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . Parameters [ 0 ] . Schema . Type ) ;
413+ Assert . Equal ( JsonSchemaTypes . String , document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . Parameters [ 0 ] . Schema . Type ) ;
401414 }
402415
403416 [ Fact ]
@@ -821,7 +834,7 @@ public void GetSwagger_SetsParameterTypeToString_IfApiParameterHasNoCorrespondin
821834
822835 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
823836 var parameter = Assert . Single ( operation . Parameters ) ;
824- Assert . Equal ( JsonSchemaType . String , parameter . Schema . Type ) ;
837+ Assert . Equal ( JsonSchemaTypes . String , parameter . Schema . Type ) ;
825838 }
826839
827840 [ Fact ]
@@ -1055,7 +1068,7 @@ public void GetSwagger_SetsResponseContentType_WhenActionHasFileResult()
10551068 var content = operation . Responses [ "200" ] . Content . FirstOrDefault ( ) ;
10561069 Assert . Equal ( "application/zip" , content . Key ) ;
10571070 Assert . Equal ( "binary" , content . Value . Schema . Format ) ;
1058- Assert . Equal ( JsonSchemaType . String , content . Value . Schema . Type ) ;
1071+ Assert . Equal ( JsonSchemaTypes . String , content . Value . Schema . Type ) ;
10591072 }
10601073
10611074 [ Fact ]
@@ -1550,8 +1563,14 @@ public void GetSwagger_SupportsOption_ParameterFilters()
15501563
15511564 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
15521565 Assert . Equal ( 2 , operation . Parameters [ 0 ] . Extensions . Count ) ;
1566+
1567+ #if NET10_0_OR_GREATER
15531568 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
15541569 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1570+ #else
1571+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Value ) ;
1572+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Value ) ;
1573+ #endif
15551574 }
15561575
15571576 [ Fact ]
@@ -1587,8 +1606,14 @@ public void GetSwagger_SupportsOption_RequestBodyFilters()
15871606
15881607 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
15891608 Assert . Equal ( 2 , operation . RequestBody . Extensions . Count ) ;
1609+
1610+ #if NET10_0_OR_GREATER
15901611 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
15911612 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1613+ #else
1614+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-foo" ] ) . Value ) ;
1615+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-docName" ] ) . Value ) ;
1616+ #endif
15921617 }
15931618
15941619 [ Fact ]
@@ -1617,8 +1642,14 @@ public void GetSwagger_SupportsOption_OperationFilters()
16171642
16181643 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
16191644 Assert . Equal ( 2 , operation . Extensions . Count ) ;
1645+
1646+ #if NET10_0_OR_GREATER
16201647 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
16211648 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1649+ #else
1650+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Extensions [ "X-foo" ] ) . Value ) ;
1651+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Extensions [ "X-docName" ] ) . Value ) ;
1652+ #endif
16221653 }
16231654
16241655 [ Fact ]
@@ -1642,9 +1673,15 @@ public void GetSwagger_SupportsOption_DocumentFilters()
16421673 var document = subject . GetSwagger ( "v1" ) ;
16431674
16441675 Assert . Equal ( 2 , document . Extensions . Count ) ;
1676+ Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1677+
1678+ #if NET10_0_OR_GREATER
16451679 Assert . Equal ( "bar" , ( ( OpenApiAny ) document . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
16461680 Assert . Equal ( "v1" , ( ( OpenApiAny ) document . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1647- Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1681+ #else
1682+ Assert . Equal ( "bar" , ( ( OpenApiString ) document . Extensions [ "X-foo" ] ) . Value ) ;
1683+ Assert . Equal ( "v1" , ( ( OpenApiString ) document . Extensions [ "X-docName" ] ) . Value ) ;
1684+ #endif
16481685 }
16491686
16501687 [ Fact ]
@@ -1673,8 +1710,14 @@ public async Task GetSwaggerAsync_SupportsOption_OperationFilters()
16731710
16741711 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
16751712 Assert . Equal ( 2 , operation . Extensions . Count ) ;
1713+
1714+ #if NET10_0_OR_GREATER
16761715 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
16771716 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1717+ #else
1718+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Extensions [ "X-foo" ] ) . Value ) ;
1719+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Extensions [ "X-docName" ] ) . Value ) ;
1720+ #endif
16781721 }
16791722
16801723 [ Fact ]
@@ -1703,8 +1746,14 @@ public async Task GetSwaggerAsync_SupportsOption_OperationAsyncFilters()
17031746
17041747 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
17051748 Assert . Equal ( 2 , operation . Extensions . Count ) ;
1749+
1750+ #if NET10_0_OR_GREATER
17061751 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
17071752 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1753+ #else
1754+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Extensions [ "X-foo" ] ) . Value ) ;
1755+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Extensions [ "X-docName" ] ) . Value ) ;
1756+ #endif
17081757 }
17091758
17101759 [ Fact ]
@@ -1728,9 +1777,15 @@ public async Task GetSwaggerAsync_SupportsOption_DocumentAsyncFilters()
17281777 var document = await subject . GetSwaggerAsync ( "v1" ) ;
17291778
17301779 Assert . Equal ( 2 , document . Extensions . Count ) ;
1780+ Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1781+
1782+ #if NET10_0_OR_GREATER
17311783 Assert . Equal ( "bar" , ( ( OpenApiAny ) document . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
17321784 Assert . Equal ( "v1" , ( ( OpenApiAny ) document . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1733- Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1785+ #else
1786+ Assert . Equal ( "bar" , ( ( OpenApiString ) document . Extensions [ "X-foo" ] ) . Value ) ;
1787+ Assert . Equal ( "v1" , ( ( OpenApiString ) document . Extensions [ "X-docName" ] ) . Value ) ;
1788+ #endif
17341789 }
17351790
17361791 [ Fact ]
@@ -1754,9 +1809,15 @@ public async Task GetSwaggerAsync_SupportsOption_DocumentFilters()
17541809 var document = await subject . GetSwaggerAsync ( "v1" ) ;
17551810
17561811 Assert . Equal ( 2 , document . Extensions . Count ) ;
1812+ Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1813+
1814+ #if NET10_0_OR_GREATER
17571815 Assert . Equal ( "bar" , ( ( OpenApiAny ) document . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
17581816 Assert . Equal ( "v1" , ( ( OpenApiAny ) document . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1759- Assert . Contains ( "ComplexType" , document . Components . Schemas . Keys ) ;
1817+ #else
1818+ Assert . Equal ( "bar" , ( ( OpenApiString ) document . Extensions [ "X-foo" ] ) . Value ) ;
1819+ Assert . Equal ( "v1" , ( ( OpenApiString ) document . Extensions [ "X-docName" ] ) . Value ) ;
1820+ #endif
17601821 }
17611822
17621823 [ Fact ]
@@ -1792,8 +1853,14 @@ public async Task GetSwaggerAsync_SupportsOption_RequestBodyAsyncFilters()
17921853
17931854 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
17941855 Assert . Equal ( 2 , operation . RequestBody . Extensions . Count ) ;
1856+
1857+ #if NET10_0_OR_GREATER
17951858 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
17961859 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1860+ #else
1861+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-foo" ] ) . Value ) ;
1862+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-docName" ] ) . Value ) ;
1863+ #endif
17971864 }
17981865
17991866 [ Fact ]
@@ -1829,8 +1896,14 @@ public async Task GetSwaggerAsync_SupportsOption_RequestBodyFilters()
18291896
18301897 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
18311898 Assert . Equal ( 2 , operation . RequestBody . Extensions . Count ) ;
1899+
1900+ #if NET10_0_OR_GREATER
18321901 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
18331902 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . RequestBody . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1903+ #else
1904+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-foo" ] ) . Value ) ;
1905+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . RequestBody . Extensions [ "X-docName" ] ) . Value ) ;
1906+ #endif
18341907 }
18351908
18361909 [ Fact ]
@@ -1866,8 +1939,14 @@ public async Task GetSwaggerAsync_SupportsOption_ParameterFilters()
18661939
18671940 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
18681941 Assert . Equal ( 2 , operation . Parameters [ 0 ] . Extensions . Count ) ;
1942+
1943+ #if NET10_0_OR_GREATER
18691944 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
18701945 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1946+ #else
1947+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Value ) ;
1948+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Value ) ;
1949+ #endif
18711950 }
18721951
18731952 [ Fact ]
@@ -1903,8 +1982,14 @@ public async Task GetSwaggerAsync_SupportsOption_ParameterAsyncFilters()
19031982
19041983 var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
19051984 Assert . Equal ( 2 , operation . Parameters [ 0 ] . Extensions . Count ) ;
1985+
1986+ #if NET10_0_OR_GREATER
19061987 Assert . Equal ( "bar" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Node . GetValue < string > ( ) ) ;
19071988 Assert . Equal ( "v1" , ( ( OpenApiAny ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Node . GetValue < string > ( ) ) ;
1989+ #else
1990+ Assert . Equal ( "bar" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-foo" ] ) . Value ) ;
1991+ Assert . Equal ( "v1" , ( ( OpenApiString ) operation . Parameters [ 0 ] . Extensions [ "X-docName" ] ) . Value ) ;
1992+ #endif
19081993 }
19091994
19101995 [ Theory ]
@@ -2345,10 +2430,10 @@ public void GetSwagger_GenerateConsumesSchemas_ForProvidedOpenApiOperationWithIF
23452430 var content = Assert . Single ( document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . RequestBody . Content ) ;
23462431 Assert . Equal ( "application/someMediaType" , content . Key ) ;
23472432 Assert . NotNull ( content . Value . Schema ) ;
2348- Assert . Equal ( JsonSchemaType . Object , content . Value . Schema . Type ) ;
2433+ Assert . Equal ( JsonSchemaTypes . Object , content . Value . Schema . Type ) ;
23492434 Assert . NotEmpty ( content . Value . Schema . Properties ) ;
23502435 Assert . NotNull ( content . Value . Schema . Properties [ "param" ] ) ;
2351- Assert . Equal ( JsonSchemaType . String , content . Value . Schema . Properties [ "param" ] . Type ) ;
2436+ Assert . Equal ( JsonSchemaTypes . String , content . Value . Schema . Properties [ "param" ] . Type ) ;
23522437 Assert . Equal ( "binary" , content . Value . Schema . Properties [ "param" ] . Format ) ;
23532438 Assert . NotNull ( content . Value . Encoding ) ;
23542439 Assert . NotNull ( content . Value . Encoding [ "param" ] ) ;
@@ -2407,12 +2492,12 @@ public void GetSwagger_GenerateConsumesSchemas_ForProvidedOpenApiOperationWithIF
24072492 var content = Assert . Single ( document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . RequestBody . Content ) ;
24082493 Assert . Equal ( "application/someMediaType" , content . Key ) ;
24092494 Assert . NotNull ( content . Value . Schema ) ;
2410- Assert . Equal ( JsonSchemaType . Object , content . Value . Schema . Type ) ;
2495+ Assert . Equal ( JsonSchemaTypes . Object , content . Value . Schema . Type ) ;
24112496 Assert . NotEmpty ( content . Value . Schema . Properties ) ;
24122497 Assert . NotNull ( content . Value . Schema . Properties [ "param" ] ) ;
2413- Assert . Equal ( JsonSchemaType . Array , content . Value . Schema . Properties [ "param" ] . Type ) ;
2498+ Assert . Equal ( JsonSchemaTypes . Array , content . Value . Schema . Properties [ "param" ] . Type ) ;
24142499 Assert . NotNull ( content . Value . Schema . Properties [ "param" ] . Items ) ;
2415- Assert . Equal ( JsonSchemaType . String , content . Value . Schema . Properties [ "param" ] . Items . Type ) ;
2500+ Assert . Equal ( JsonSchemaTypes . String , content . Value . Schema . Properties [ "param" ] . Items . Type ) ;
24162501 Assert . Equal ( "binary" , content . Value . Schema . Properties [ "param" ] . Items . Format ) ;
24172502 Assert . NotNull ( content . Value . Encoding ) ;
24182503 Assert . NotNull ( content . Value . Encoding [ "param" ] ) ;
@@ -2471,10 +2556,10 @@ public void GetSwagger_GenerateConsumesSchemas_ForProvidedOpenApiOperationWithSt
24712556 var content = Assert . Single ( document . Paths [ "/resource" ] . Operations [ OperationType . Post ] . RequestBody . Content ) ;
24722557 Assert . Equal ( "application/someMediaType" , content . Key ) ;
24732558 Assert . NotNull ( content . Value . Schema ) ;
2474- Assert . Equal ( JsonSchemaType . Object , content . Value . Schema . Type ) ;
2559+ Assert . Equal ( JsonSchemaTypes . Object , content . Value . Schema . Type ) ;
24752560 Assert . NotEmpty ( content . Value . Schema . Properties ) ;
24762561 Assert . NotNull ( content . Value . Schema . Properties [ "param" ] ) ;
2477- Assert . Equal ( JsonSchemaType . String , content . Value . Schema . Properties [ "param" ] . Type ) ;
2562+ Assert . Equal ( JsonSchemaTypes . String , content . Value . Schema . Properties [ "param" ] . Type ) ;
24782563 Assert . NotNull ( content . Value . Encoding ) ;
24792564 Assert . NotNull ( content . Value . Encoding [ "param" ] ) ;
24802565 Assert . Equal ( ParameterStyle . Form , content . Value . Encoding [ "param" ] . Style ) ;
0 commit comments