42Crunch / vscode-openapi

VisualStudio Code OpenAPI tools
GNU Affero General Public License v3.0
332 stars 41 forks source link

Editor Preview won't open: Failed to generate preview, check OpenAPI file for errors. #151

Closed ANTGOMEZ closed 2 years ago

ANTGOMEZ commented 2 years ago

Using OpenAPI editor, latest with VsCode Version: 1.63.0 (user setup) Commit: 7db1a2b88f7557e0a43fec75b6ba7e50b3e9f77e Date: 2021-12-07T06:26:56.179Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042

It used to work for me, but now it doesn't, no OS or VSCode changes. Issues above error when I Invoke the editor preview window: Failed to generate preview, check OpenAPI file for errors.

How can I see what the actual error is?

My OpenAPI file is formatted correctly, has no errors.

I uninstalled and re-installed the extension, still same issue.

Ideas?

Thanks!

ak1394 commented 2 years ago

Hi! One of the resent changes in the extension which might be related to your issue is that we started to threat the duplicate keys in JSON as an error, but in this case you should see an error highlighted in the body of your file.

Could you share your OpenAPI file so I could have a look at it?

ANTGOMEZ commented 2 years ago

Here's the file:

swagger: '2.0' info: description: 'This is the swagger page for Data Catalog API. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger' version: 1.0.0 title: Data Catalog API termsOfService: http://swagger.io/terms/ contact: email: eibi@ebs.com license: name: Apache 2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html host: datacatalog-api.ebiqa.com basePath: / tags:

ANTGOMEZ commented 2 years ago

sorry about the formatting here, github changes it. But in actuality it's correct, no errors.

ak1394 commented 2 years ago

Thanks for providing the sample (it's easier to just drag-n-drop a file into the comment box) but this way it worked as well.

There seems to be an issue in both the file and our extension :). The problem with the file is that there is a Tab character on line 51 (the line reads "description: Error occurred in download request") if you replace it with the space it will solve the issue.

The problem with the extension, that we did not show the relevant error in the text editor, I'll address it in the one of the next releases.

ANTGOMEZ commented 2 years ago

Yup, that was it. Thanks!! I'll turn on Show All Chars in vscode. Woulda caught that.

ak1394 commented 2 years ago

Latest release shows tabs present in the YAML file as errors