Skip to content

Cannot disable server name validation if the servers array includes a base path. #1123

@codestation

Description

@codestation

According to #882 , setting swagger.Servers = nil skips the server name matching, but the problem is if for example one has a base path in the server url entry (for example the petstore) it causes that all the routes return no matching operation was found.

In my case this is my server array and a path:

servers:
  - url: 'http://localhost:8000/apis/myapp/v1'
paths:
  "/health/live":
  ...

Calling http://localhost:8000/apis/myapp/v1/health/live fails if Servers is nil. I tried to debug and found that it tries to match /apis/myapp/v1/health/live (the request) with ^/health/live$ (the route).

Maybe doing Servers = nil is a bad idea as it drops critical information (the base path), so another way should be implemented.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions