swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

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

Open StefanBauerTT opened this issue 1 year ago • 1 comments

Q&A (please complete the following information)

  • OS: Windows
  • Browser: Firefox
  • Version: 129
  • Method of installation: Online Version https://editor.swagger.io/
  • Swagger-Editor version: online version
  • Swagger/OpenAPI version: OpenAPI 3.0

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...

  • Click "GET /api/v1/employees"
  • Click "Try it out"
  • Click "Execute"

Expected behavior

  • The request URL is "https://dummy.restapiexample.com/api/v1/employees"
  • The response shows some JSON

Actual behaviour

  • The request URL is https://editor.swagger.io/https%3A%2F%2Fdummy.restapiexample.com/api/v1/employees
  • The response is a 404

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

StefanBauerTT avatar Aug 29 '24 06:08 StefanBauerTT

Hi @StefanBauerTT,

This has been addressed upstream in https://github.com/swagger-api/swagger-js/releases/tag/v3.29.3. We would need to re-release the SwaggerEditor@4 to fix this issue in https://editor.swagger.io/.

char0n avatar Sep 20 '24 11:09 char0n

We’ve released Swagger Editor v5! 🎉 Check out the details here: Inside the New Swagger Editor. We’re closing old issues related to previous versions. If you think any of them are still relevant, please open a new issue – this helps us prioritize what matters most. Thanks for your activity! 🚀

MichakrawSB avatar Dec 05 '25 14:12 MichakrawSB