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

Wrong Swagger url generated when using KubernetesServiceDiscoveryProvider #264

Open
sirdawidd opened this issue May 3, 2023 · 1 comment
Assignees
Labels

Comments

@sirdawidd
Copy link

sirdawidd commented May 3, 2023

Describe the bug
Im using KubernetesServiceDiscoveryProvider ,
I defined swagger endpoint

 {
      "Key": "starwars",
      "Config": [
        {
          "Name": "starwars API",
          "Version": "v1",
          "Service": {
            "Name": "starwars",
            "Path": "/swagger/docs/v1/swagger.json"
          }
        }
      ]
    }

In routes i have
"UpstreamPathTemplate": "/starwars/{everything}",

By this configuration I only get error that
Failed to match Route configuration for upstream path: /swagger/docs/v1/starwars
Which is true because I didn't know that i need to define extra route

So after adding another rote configuration
"UpstreamPathTemplate": "/swagger/docs/v1/starwars",
It was working fine.

Expected behavior
Dont really know why swagger routes generated by this library are opposed instead starwars/swagger/docs/v1/ what is generated is /swagger/docs/v1/starwars
I assume reason is that my swagger endpoint is not as in documentation domain/swagger but domain/api/swagger

Config file

{
  "Routes": [
    {
      "SwaggerKey": "starwars",
      "DownstreamPathTemplate": "/api/swagger/docs/v1/swagger.json",
      "DownstreamScheme": "http",
      "DownstreamHostAndPorts": [
        {
          "Host": "starwars.svc.cluster.local",
          "Port": 80
        }
      ],
      "UpstreamPathTemplate": "/swagger/docs/v1/starwars",
      "UpstreamHttpMethod": [
        "Options",
        "Head",
        "Get",
        "Post",
        "Put",
        "Patch",
        "Delete"
      ],
      "RouteIsCaseSensitive": false,
      "DangerousAcceptAnyServerCertificateValidator": true,
      "Priority": 1
    },
    {
      "SwaggerKey": "starwars",
      "DownstreamPathTemplate": "/api/{everything}",
      "DownstreamScheme": "http",
      "DownstreamHostAndPorts": [
        {
          "Host": "starwars.svc.cluster.local",
          "Port": 80
        }
      ],
      "UpstreamPathTemplate": "/starwars/{everything}",
      "UpstreamHttpMethod": [
        "Options",
        "Head",
        "Get",
        "Post",
        "Put",
        "Patch",
        "Delete"
      ],
      "RouteIsCaseSensitive": false,
      "DangerousAcceptAnyServerCertificateValidator": true,
      "Priority": 0,
      "AuthenticationOptions": {
        "AuthenticationProviderKey": "Admin",
        "AllowedScopes": []
      }
    },
   
  ],
  "GlobalConfiguration": {
    "BaseUrl": ".......",
    "ServiceDiscoveryProvider": {
      "Namespace": "svc...",
      "Type": "kube"
    }
  },
  "SwaggerEndPoints": [
    {
      "Key": "starwars",
      "Config": [
        {
          "Name": "starwars API",
          "Version": "v1",
          "Service": {
            "Name": "starwars",
            "Path": "/swagger/docs/v1/swagger.json"
          }
        }
      ]
    }
  ]
}
@stale
Copy link

stale bot commented Jun 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the inactive label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants