diff --git a/src/utils/openapi.ts b/src/utils/openapi.ts index a518ee5a..2572b1d5 100644 --- a/src/utils/openapi.ts +++ b/src/utils/openapi.ts @@ -14,7 +14,7 @@ import { Referenced, } from '../types'; import { IS_BROWSER } from './dom'; -import { isNumeric, removeQueryString, resolveUrl, stripTrailingSlash } from './helpers'; +import { isNumeric, removeQueryString, resolveUrl } from './helpers'; function isWildcardStatusCode(statusCode: string | number): statusCode is string { return typeof statusCode === 'string' && /\dxx/i.test(statusCode); @@ -530,9 +530,10 @@ export function normalizeServers( const baseUrl = specUrl === undefined ? removeQueryString(getHref()) : dirname(specUrl); if (servers.length === 0) { - return [ + // Behaviour defined in OpenAPI spec: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#openapi-object + servers = [ { - url: stripTrailingSlash(baseUrl), + url: '/', }, ]; }