in api/internal/handler/data_loader/route_export.go [432:466]
func ParseRouteUris(route *entity.Route, paths openapi3.Paths, paramsRefs []*openapi3.ParameterRef, pathItem *openapi3.PathItem, _pathNumber int) (openapi3.Paths, []*openapi3.ParameterRef) {
routeURIs := []string{}
if route.URI != "" {
routeURIs = append(routeURIs, route.URI)
}
if route.Uris != nil {
routeURIs = route.Uris
}
for _, uri := range routeURIs {
if strings.Contains(uri, "*") {
if _, ok := paths[strings.Split(uri, "*")[0]+"{params}"]; !ok {
paths[strings.Split(uri, "*")[0]+"{params}"] = pathItem
} else {
paths[strings.Split(uri, "*")[0]+"{params}"+"-APISIX-REPEAT-URI-"+strconv.Itoa(_pathNumber)] = pathItem
}
// add params introduce
paramsRefs = append(paramsRefs, &openapi3.ParameterRef{
Value: &openapi3.Parameter{
In: "path",
Name: "params",
Required: true,
Description: "params in path",
Schema: &openapi3.SchemaRef{Value: &openapi3.Schema{Type: "string"}}}})
} else {
if _, ok := paths[uri]; !ok {
paths[uri] = pathItem
} else {
paths[uri+"-APISIX-REPEAT-URI-"+strconv.Itoa(_pathNumber)] = pathItem
}
}
}
return paths, paramsRefs
}