Burgyn / MMLib.SwaggerForOcelot

This repo contains swagger extension for ocelot.
MIT License
351 stars 93 forks source link

Path params don't work when using KubernetesServiceDiscoveryProvider #252

Closed Arik-Shapiro closed 1 year ago

Arik-Shapiro commented 1 year ago

Describe the bug A clear and concise description of what the bug is. When using the KubernetesServiceDiscoveryProvider some endpoints just do not appear in swagger doc.

{
    "Routes": [
        {
            "DownstreamPathTemplate": "/api/audit/{everything}",
            "UpstreamPathTemplate": "/api/audit/{everything}",
            "ServiceName": "audit-service",
        },
        {
            "DownstreamPathTemplate": "/api/audit",
            "UpstreamPathTemplate": "/api/audit",
            "ServiceName": "audit-service",
            "SwaggerKey": "audit"
        }
    ],
    "GlobalConfiguration": {
        "DownstreamScheme": "http",
        "ServiceDiscoveryProvider": {
            "Namespace": "default",
            "Type": "KubernetesServiceDiscoveryProvider"
        },
    },
    "SwaggerEndPoints": [
        {
            "Key": "audit",
            "Config": [
                {
                    "Name": "Audit API",
                    "Version": "v1",
                    "Service": {
                        "Name": "audit-service",
                        "Path": "/swagger/v1/swagger.json"
                    }
                }
            ]
        }
    ]
}

image

When using this one locally:

{
    "Routes": [
        {
            "DownstreamPathTemplate": "/api/audit/{everything}",
            "DownstreamHostAndPorts": [
                {
                    "Host": "localhost",
                    "Port": 5135
                }
            ],
            "UpstreamPathTemplate": "/api/audit/{everything}",
            "SwaggerKey": "audit"
        },
        {
            "DownstreamPathTemplate": "/api/audit",
            "DownstreamScheme": "http",
            "DownstreamHostAndPorts": [
                {
                    "Host": "localhost",
                    "Port": 5135
                }
            ],
            "UpstreamPathTemplate": "/api/audit",
            "SwaggerKey": "audit"
        }
    ],
    "SwaggerEndPoints": [
        {
            "Key": "audit",
            "Config": [
                {
                    "Version": "v1",
                    "Name": "Audit API",
                    "Url": "http://localhost:5135/swagger/v1/swagger.json"
                }
            ]
        }
    ]
}

Everything works as expected image

Would appreciate some help, thanks!