@@ -308,6 +308,34 @@ func TestWildcards(t *testing.T) {
308
308
assert .NotNil (t , swagger .Paths .Value ("/namespaces/{ns}/example1/{id}" ))
309
309
}
310
310
311
+ func TestSamePathWithDifferentValues (t * testing.T ) {
312
+ routes := []* Route {
313
+ {
314
+ Name : "op1" ,
315
+ Path : "namespaces/{ns}/example1/{id}" ,
316
+ Method : http .MethodPost ,
317
+ JSONInputValue : func () interface {} { return & TestStruct1 {} },
318
+ JSONOutputCodes : []int {http .StatusOK },
319
+ },
320
+ {
321
+ Name : "op2" ,
322
+ Path : "namespaces/{ns}/example1/{did}" ,
323
+ Method : http .MethodPost ,
324
+ JSONInputValue : func () interface {} { return & TestStruct1 {} },
325
+ JSONOutputCodes : []int {http .StatusOK },
326
+ },
327
+ }
328
+ swagger := NewSwaggerGen (& SwaggerGenOptions {
329
+ Title : "UnitTest" ,
330
+ Version : "1.0" ,
331
+ BaseURL : "http://localhost:12345/api/v1" ,
332
+ }).Generate (context .Background (), routes )
333
+ assert .Equal (t , 2 , swagger .Paths .Len ())
334
+ assert .NotNil (t , swagger .Paths .Find ("/namespaces/{ns}/example1/{id}" ))
335
+ assert .NotNil (t , swagger .Paths .Value ("/namespaces/{ns}/example1/{id}" ))
336
+ assert .NotNil (t , swagger .Paths .Find ("/namespaces/{ns}/example1/{did}" ))
337
+ assert .NotNil (t , swagger .Paths .Value ("/namespaces/{ns}/example1/{did}" ))
338
+ }
311
339
func TestFFExcludeTag (t * testing.T ) {
312
340
routes := []* Route {
313
341
{
0 commit comments