@@ -38,7 +38,7 @@ public void GetSwagger_GeneratesSwaggerDocument_ForApiDescriptionsWithMatchingGr
3838 c => nameof ( c . ActionWithNoParameters ) , groupName : "v1" , httpMethod : "GET" , relativePath : "resource" ) ,
3939
4040 ApiDescriptionFactory . Create < FakeController > (
41- c => nameof ( c . ActionWithNoParameters ) , groupName : "v2" , httpMethod : "POST" , relativePath : "resource" ) ,
41+ c => nameof ( c . ActionWithNoParameters ) , groupName : "v2" , httpMethod : "POST" , relativePath : "resource" )
4242 } ,
4343 options : new SwaggerGeneratorOptions
4444 {
@@ -2523,6 +2523,51 @@ public void GetSwagger_OpenApiOperationWithRawContent_IsHandled()
25232523 Assert . Single ( document . Paths [ "/resource" ] . Operations ) ;
25242524 }
25252525
2526+ [ Fact ]
2527+ public void GetSwagger_BindingSourceQueryParameter_NotThrowsException ( )
2528+ {
2529+ var apiDescription = new ApiDescription
2530+ {
2531+ HttpMethod = "GET" ,
2532+ ActionDescriptor = new ActionDescriptor
2533+ {
2534+ RouteValues = new Dictionary < string , string >
2535+ {
2536+ [ "controller" ] = "Catalog"
2537+ }
2538+ } ,
2539+ RelativePath = "api/v1/Images/{image}" ,
2540+ GroupName = "v1" ,
2541+ ParameterDescriptions =
2542+ {
2543+ new ApiParameterDescription
2544+ {
2545+ Name = "width" ,
2546+ Source = BindingSource . Query ,
2547+ DefaultValue = string . Empty ,
2548+ Type = typeof ( int )
2549+ }
2550+ }
2551+ } ;
2552+ var subject = Subject (
2553+ apiDescriptions :
2554+ [
2555+ apiDescription
2556+ ] ,
2557+ options : new SwaggerGeneratorOptions
2558+ {
2559+ SwaggerDocs = new Dictionary < string , OpenApiInfo >
2560+ {
2561+ [ "v1" ] = new ( ) { Version = "V1" , Title = "Test API" }
2562+ }
2563+ }
2564+ ) ;
2565+
2566+ var document = subject . GetSwagger ( "v1" ) ;
2567+
2568+ Assert . NotNull ( document ) ;
2569+ }
2570+
25262571 private static SwaggerGenerator Subject (
25272572 IEnumerable < ApiDescription > apiDescriptions ,
25282573 SwaggerGeneratorOptions options = null ,
0 commit comments