Skip to content

Commit 0d074d0

Browse files
committed
Do not include default basePath in output.
1 parent ecc9ea0 commit 0d074d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,10 @@ private static void WriteHostInfoV2(IOpenApiWriter writer, IList<OpenApiServer>
240240
firstServerUrl.GetComponents(UriComponents.Host | UriComponents.Port, UriFormat.SafeUnescaped));
241241

242242
// basePath
243-
writer.WriteProperty(OpenApiConstants.BasePath, firstServerUrl.AbsolutePath);
243+
if (firstServerUrl.AbsolutePath != "/")
244+
{
245+
writer.WriteProperty(OpenApiConstants.BasePath, firstServerUrl.AbsolutePath);
246+
}
244247

245248
// Consider all schemes of the URLs in the server list that have the same
246249
// host, port, and base path as the first server.

0 commit comments

Comments
 (0)