@@ -1410,6 +1410,75 @@ public void GetSwagger_SupportsOption_DescribeAllParametersInCamelCase(
14101410 Assert . Equal ( expectedOpenApiParameterName , parameter . Name ) ;
14111411 }
14121412
1413+ [ Theory ]
1414+ [ InlineData ( "SomeParam" , "someParam" ) ]
1415+ [ InlineData ( "FooBar.SomeParam" , "fooBar.someParam" ) ]
1416+ [ InlineData ( "A.B" , "a.b" ) ]
1417+ [ InlineData ( "" , "" ) ]
1418+ [ InlineData ( null , null ) ]
1419+ public void GetSwagger_SupportsOption_DescribeAllParametersInCamelCase_ForParametersFromMetadata (
1420+ string parameterName ,
1421+ string expectedOpenApiParameterName )
1422+ {
1423+ var methodInfo = typeof ( FakeController ) . GetMethod ( nameof ( FakeController . ActionWithParameter ) ) ;
1424+ var actionDescriptor = new ActionDescriptor
1425+ {
1426+ EndpointMetadata = new List < object > ( )
1427+ {
1428+ new OpenApiOperation
1429+ {
1430+ OperationId = "OperationIdSetInMetadata" ,
1431+ Parameters = new List < OpenApiParameter > ( )
1432+ {
1433+ new OpenApiParameter
1434+ {
1435+ Name = parameterName
1436+ }
1437+ }
1438+ }
1439+ } ,
1440+ RouteValues = new Dictionary < string , string >
1441+ {
1442+ [ "controller" ] = methodInfo . DeclaringType . Name . Replace ( "Controller" , string . Empty )
1443+ }
1444+ } ;
1445+ var subject = Subject (
1446+ apiDescriptions : new [ ]
1447+ {
1448+ ApiDescriptionFactory . Create (
1449+ actionDescriptor ,
1450+ methodInfo ,
1451+ groupName : "v1" ,
1452+ httpMethod : "POST" ,
1453+ relativePath : "resource" ,
1454+ parameterDescriptions : new [ ]
1455+ {
1456+ new ApiParameterDescription
1457+ {
1458+ Name = parameterName ,
1459+ Source = BindingSource . Path ,
1460+ ModelMetadata = ModelMetadataFactory . CreateForType ( typeof ( string ) ) ,
1461+ Type = typeof ( string )
1462+ }
1463+ } ) ,
1464+ } ,
1465+ options : new SwaggerGeneratorOptions
1466+ {
1467+ SwaggerDocs = new Dictionary < string , OpenApiInfo >
1468+ {
1469+ [ "v1" ] = new OpenApiInfo { Version = "V1" , Title = "Test API" }
1470+ } ,
1471+ DescribeAllParametersInCamelCase = true
1472+ }
1473+ ) ;
1474+
1475+ var document = subject . GetSwagger ( "v1" ) ;
1476+
1477+ var operation = document . Paths [ "/resource" ] . Operations [ OperationType . Post ] ;
1478+ var parameter = Assert . Single ( operation . Parameters ) ;
1479+ Assert . Equal ( expectedOpenApiParameterName , parameter . Name ) ;
1480+ }
1481+
14131482 [ Fact ]
14141483 public void GetSwagger_SupportsOption_Servers ( )
14151484 {
0 commit comments