Open
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Version: 128
- Method of installation: npm
- Swagger-UI version: 5.17.14
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Example Swagger/OpenAPI definition:
---
openapi: "3.0.1"
info:
title: "Random Yes/No"
version: "1.0.0"
servers:
- url: "{server}/api"
variables:
server:
default: "https://yesno.wtf"
paths:
/:
get:
description: "Yes or no"
responses:
"200":
description: "OK"
content:
"application/json":
schema:
properties:
answer:
type: string
forced:
type: boolean
image:
type: string
format: uri
Describe the bug you're encountering
The wrong URL used when executing the request from swagger ui when a server url starts with a variable.
I feel this should work as the spec not having any validation issues and there is a similar example in the exaples section on this page https://swagger.io/docs/specification/api-host-and-base-path/ (see SaaS and On-Premise).
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor.swagger.io/
- Paste the spec from the issue in the editor
- Click "Try it out"
- Click "Execute"
A request is now performed but it failed due to the request url getting prefixed with https://editor.swagger.io/
Expected behavior
A get request to https://yesno.wtf/api/
When manually replacing the {server} variable in the url with with the default value the hostname is not prefixed and the correct server url is used.
Metadata
Metadata
Assignees
Labels
No labels