Closed ShvetsovAU closed 3 years ago
Hi,
thanks for your issue.
In the first gateway use specific swagger endpoint insteadof generic swagger.json
. ("Url": "http://localhost:5888/swagger/v1/secondgateway"
)
"SwaggerEndPoints": [
{
"Key": "secondgateway",
"Config": [
{
"Name": "secondgateway",
"Version": "v1",
"Url": "http://localhost:5888/swagger/v1/secondgateway"
}
]
} ]
You must define a
SwagerKey
property on each route definition, not inGlobalConfiguration
.
Hi,
thanks for your issue.
In the first gateway use specific swagger endpoint insteadof generic
swagger.json
. ("Url": "http://localhost:5888/swagger/v1/secondgateway"
)"SwaggerEndPoints": [ { "Key": "secondgateway", "Config": [ { "Name": "secondgateway", "Version": "v1", "Url": "http://localhost:5888/swagger/v1/secondgateway" } ] } ]
You must define a
SwagerKey
property on each route definition, not inGlobalConfiguration
.
Hi, thank you.
Work with next:
"SwaggerEndPoints": [
{
"Key": "secondgateway",
"Config": [
{
"Name": "secondgateway",
"Version": "v1",
"Url": "http://localhost:5888/swagger/docs/v1/secondgateway"
}
]
} ]
Hi, Thanks for the reply. I'm glad you solved the problem
Hi.
We have two ocelot projects, which reroute requests from first to second. In second project we have next config (for example):
{ "Routes": [ { "DownstreamPathTemplate": "/api/v2/Comment", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5079 } ], "DownstreamScheme": "http", "UpstreamPathTemplate": "/api/v2/Comment", "UpstreamHttpMethod": [ "GET" ], "SwaggerKey": "doctor" }, { "DownstreamPathTemplate": "/api/v1/favorite/me", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5079 } ], "DownstreamScheme": "http", "UpstreamPathTemplate": "/api/v1/favorite/me", "UpstreamHttpMethod": [ "POST", "DELETE" ], "SwaggerKey": "doctor" }, { "DownstreamPathTemplate": "/api/v1/Speciality", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5075 } ], "DownstreamScheme": "http", "AuthenticationOptions": { "AuthenticationProviderKey": "Bearer", "AllowedScopes": [ "api.telemedapigateway.full" ] }, "UpstreamPathTemplate": "/api/v1/Speciality", "UpstreamHttpMethod": [ "GET" ], "SwaggerKey": "telemed" } ], "SwaggerEndPoints": [ { "Key": "doctor", "Config": [ { "Name": "doctor", "Version": "v1", "Url": "http://localhost:5079/swagger/v1/swagger.json" }, { "Name": "doctor", "Version": "v2", "Url": "http://localhost:5079/swagger/v2/swagger.json" } ] }, { "Key": "telemed", "Config": [ { "Name": "telemed", "Version": "v1", "Url": "http://localhost:5075/swagger/v1/swagger.json" } ] } ] }
First project has next config:
{ "Routes": [ { "DownstreamPathTemplate": "/api/v2/Comment", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5888 } ], "UpstreamPathTemplate": "/api/v2/Comment", "UpstreamHttpMethod": [ "GET" ] }, { "DownstreamPathTemplate": "/api/v1/favorite/me", "DownstreamHostAndPorts": [ { "Host": "localhost", "Port": 5888 } ], "UpstreamPathTemplate": "/api/v1/favorite/me", "UpstreamHttpMethod": [ "POST", "DELETE" ] }, { "DownstreamPathTemplate": "/api/v1/Speciality", "DownstreamHostAndPorts": [ { "Host": "master.budu-secondgateway.k8s.dev.renhealth", "Port": 80 } ], "UpstreamPathTemplate": "/api/v1/Speciality", "UpstreamHttpMethod": [ "GET" ] } ], "GlobalConfiguration": { "DownstreamScheme": "http", "SwaggerKey": "secondgateway" }, "SwaggerEndPoints": [ { "Key": "secondgateway", "Config": [ { "Name": "secondgateway", "Version": "v1", "Url": "http://localhost:5888/swagger/v1/swagger.json" } ] } ] }
When run first project and open swagger url in browser, we get error "Failed to load API definition. Fetch errorInternal Server Error /swagger/docs/v1/secondgateway".
How i can configurate projects, so that we can browse swagger's documents from second project in first?