WSL2 paths in $ref are being generated with an extraneous /
stevegoossens opened this issue · comments
What happened?
All OpenAPI yaml files that have $ref
values pointing at a relative "external" OpenAPI yaml file have the WSL2 file://
path generated with an extraneous /
character after the "wsl", e.g.
file://wsl/%24/Ubuntu-20.04/home/steve/github/bbc/account-service-contract/openapi/base.yaml
This filepath is NOT valid in Windows Explorer, and nothing loads when pasting it into Windows Explorer address bar and pressing Enter.
What should have happened instead?
The WSL2 file locations should be generated without the /
character following "wsl", e.g.
file://wsl%24/Ubuntu-20.04/home/steve/github/bbc/account-service-contract/openapi/base.yaml
This file URL is valid in Windows Explorer, and pasting this into its address bar and pressing Enter produces an Open File With dialog window, including the option to open in VS Code, which successfully opens.
Minimal reproducible OpenAPI snippet
main-example.yaml
openapi: '3.0.0'
info:
title: '@project.name@'
version: '@project.version@'
description: main
servers:
- url: http://localhost:8080
description: Local development (Spring Boot)
paths:
/v3/user/association:
post:
tags:
- user
summary: Create user association
parameters:
- $ref: 'base-example.yaml#/components/parameters/headerXray'
description: The ref above currently generates a malformed WSL2 path in Redocly extension
operationId: association
responses:
'204':
description: Success. The account association was created.
base-example.yaml
openapi: '3.0.0'
info:
description: blah
version: '@project.version@'
title: '@project.name@'
servers:
- url: http://localhost:8080
description: Local development (Spring Boot)
paths:
/placeholder:
get:
summary: Placeholder
description: |
This is just a pretend API endpoint to satisfy the OpenAPI spec of having at least one
URI path. It is **NOT** a real API path.
responses:
'200':
description: OK
content:
text/plain:
schema:
type: string
example: dummy
components:
parameters:
headerXray:
name: x-amzn-trace-id
in: header
description: "**Automatically Generated** upstream (if AWS X-Ray is enabled)"
schema:
type: string
Screenshots
This results in errors for all WSL2 paths in $ref
values, e.g.
You can see that the Windows UNC path is resolved to \\wsl\$\Ubuntu-20.04\home\steve\github\bbc\account-service-contract\openapi\base-example.yaml
which is incorrect and should be \\wsl$\Ubuntu-20.04\home\steve\github\bbc\account-service-contract\openapi\base-example.yaml
.
Additional context
VS Code is the Windows application. My OpenAPI project is on a Ubuntu filesystem in a WSL2 installation.
Redocly OpenAPI extension 0.2.2
Released on
13/08/2021, 14:29:18
Last updated
25/01/2022, 10:20:33
Identifier
redocly.openapi-vs-code
PS C:\Users\steve> wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu-20.04 (Default)
docker-desktop-data
docker-desktop
Edition Windows 10 Pro
Version 21H1
Installed on 27/06/2021
OS build 19043.1526
Experience Windows Feature Experience Pack 120.2212.4170.0
Apologies, this appears to be an issue from OpenAPI (Swagger) Editor extension.
I'll close this issue and copy-paste it over there!