Default path to downstream Swagger JSON does not respect service version
Closed this issue · 0 comments
satano commented
Describe the bug
Default path for Swagger JSON is /swagger/v1/swagger.json
. This path is hard-coded in SwaggerService
class. This works only if my downstream API has version v1
, or I must manually set correct path in ocelot.config
.
To Reproduce
My downstream API has version 1.0
and I have this configuration:
"SwaggerEndPoints": [
{
"Key": "PayrollsApi",
"Config": [
{
"Name": "Payrolls Api",
"Version": "1.0",
"Service": {
"Name": "PayrollsApi"
}
}
]
}
]
This does not work, because the URL for downstream Swagger is built with path /swagger/v1/swagger.json
, but the correct path is /swagger/1.0/swagger.json
.
Of course, I can manually configure the path, so this works:
"SwaggerEndPoints": [
{
"Key": "PayrollsApi",
"Config": [
{
"Name": "Payrolls Api",
"Version": "1.0",
"Service": {
"Name": "PayrollsApi",
"Path": "/swagger/1.0/swagger.json"
}
}
]
}
]
Expected behavior
It would be nice, if the default path respects configured API version and use /swagger/v1/swagger.json
only as the last option.