swagger-api / swagger-editor

Swagger Editor
https://editor.swagger.io
Apache License 2.0
8.87k stars 2.24k forks source link

Regression: Wrong request URL if server URL scheme is part of variable (works in v3) #5219

Open StefanBauerTT opened 2 weeks ago

StefanBauerTT commented 2 weeks ago

Q&A (please complete the following information)

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.2
info:
  title: Reproducer
  version: 1.0.0
servers:
  - url: '{url}'
    variables:
      url:
        default: https://dummy.restapiexample.com

paths:
  /api/v1/employees:
    get:
      responses:
        '200':
          description: Response

Describe the bug you're encountering

When executing the GET request, the Request URL is built incorectly.

To reproduce...

Expected behavior

Actual behaviour

Additional context or thoughts

This is a regression. It works when using docker run -d -p 80:8080 swaggerapi/swagger-editor:v3.18.1

It seems to be related to the URL scheme being part of the variable substitution, as the follwing example works fine:

openapi: 3.0.2
info:
  title: Reproducer
  version: 1.0.0
servers:
  - url: 'https://{host}'
    variables:
      host:
        default: dummy.restapiexample.com

paths:
  /api/v1/employees:
    get:
      responses:
        '200':
          description: Response