@@ -313,6 +313,7 @@ func (r *Router) newMatcher(ctx context.Context) (*matcher.Matcher, []*contract.
313
313
paths := make ([]* contract.Path , 0 , len (routes ))
314
314
container := r .repository .Container ()
315
315
316
+ unique := map [string ]bool {}
316
317
var openAPIs = map [string ][]* repository.Provider {}
317
318
var optionsPaths = map [string ][]* path.Path {}
318
319
for _ , anItem := range container .Items {
@@ -340,14 +341,16 @@ func (r *Router) newMatcher(ctx context.Context) (*matcher.Matcher, []*contract.
340
341
optionsPaths [aPath .URI ] = append (optionsPaths [aPath .URI ], aPath )
341
342
}
342
343
routes = append (routes , r .NewViewMetaHandler (r .routeURL (r .config .Meta .ViewURI , aPath .URI ), provider ))
343
-
344
344
key := r .routeURL (r .config .Meta .OpenApiURI , aPath .URI )
345
345
openAPIs [key ] = append (openAPIs [key ], provider )
346
- // //routes = append(routes, r.NewOpenAPIRoute(r.routeURL(r.config.Meta.OpenApiURI, aPath.URI), r.repository, provider))
347
346
348
- routes = append (routes , r .NewStructRoute (r .routeURL (r .config .Meta .StructURI , aPath .URI ), provider ))
349
- routes = append (routes , r .NewStateRoute (r .routeURL (r .config .Meta .StateURI , aPath .URI ), provider ))
350
- routes = append (routes , r .NewMetricRoute (r .metricURL (r .config .Meta .MetricURI , aPath .URI )))
347
+ if ! unique [aPath .URI ] {
348
+ unique [aPath .URI ] = true
349
+ // //routes = append(routes, r.NewOpenAPIRoute(r.routeURL(r.config.Meta.OpenApiURI, aPath.URI), r.repository, provider))
350
+ routes = append (routes , r .NewStructRoute (r .routeURL (r .config .Meta .StructURI , aPath .URI ), provider ))
351
+ routes = append (routes , r .NewStateRoute (r .routeURL (r .config .Meta .StateURI , aPath .URI ), provider ))
352
+ routes = append (routes , r .NewMetricRoute (r .metricURL (r .config .Meta .MetricURI , aPath .URI )))
353
+ }
351
354
352
355
//TODO extend path.Path with cache info to pre exract cacheable view
353
356
//if views := router.ExtractCacheableViews(route); len(views) > 0 {
0 commit comments