Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default path to downstream Swagger JSON does not respect service version #300

Closed
satano opened this issue Jul 9, 2024 · 0 comments · Fixed by #301
Closed

Default path to downstream Swagger JSON does not respect service version #300

satano opened this issue Jul 9, 2024 · 0 comments · Fixed by #301
Assignees

Comments

@satano
Copy link
Contributor

satano commented Jul 9, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants