Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import URL does not work #2

Open
n-murphy opened this issue Aug 5, 2022 · 6 comments
Open

Import URL does not work #2

n-murphy opened this issue Aug 5, 2022 · 6 comments

Comments

@n-murphy
Copy link
Owner

n-murphy commented Aug 5, 2022

The Import URL menu option does not work with the Swagger Editor Docker extension.

It appears that the call to JavaScript prompt method does not work within a Docker extension setting.

This is the line of code that I think is causing the issue:
L95 in topbar.jsx

@n-murphy n-murphy self-assigned this Aug 5, 2022
@n-murphy
Copy link
Owner Author

n-murphy commented Aug 8, 2022

As I'm not much of a JavaScript developer, I don't have an alternative as of yet to the prompt method that will work within a Docker extension. As a result I've commented out L357 in topbar.jsx for the time being and built my own docker image for Swagger Editor which I can then use in creating a new version of Swagger Editor docker extension.

n-murphy added a commit that referenced this issue Aug 8, 2022
@n-murphy
Copy link
Owner Author

n-murphy commented Aug 8, 2022

I'm going to leave this issue open and perhaps some refactoring can be done to the topbar.jsx to replace the use of prompt with modals in the same way that its done with topbar-insert.jsx.

@n-murphy
Copy link
Owner Author

I ran some debugging on the docker extension (on the older version 0.0.4)

docker extension dev debug noelm/swagger-editor-extension:0.0.4

This displays dev tools and when I try to Import URL I get the following message:

Uncaught Error: prompt() is and will not be supported.
    at topbar.jsx:93:15
    at Object.Ue (react-dom.production.min.js:52:317)
    at Je (react-dom.production.min.js:52:471)
    at react-dom.production.min.js:53:35
    at On (react-dom.production.min.js:100:68)
    at Fn (react-dom.production.min.js:101:380)
    at react-dom.production.min.js:113:65
    at Ie (react-dom.production.min.js:292:189)
    at react-dom.production.min.js:50:57
    at Bn (react-dom.production.min.js:105:469)
(anonymous) @ topbar.jsx:93
Ue @ react-dom.production.min.js:52
Je @ react-dom.production.min.js:52
(anonymous) @ react-dom.production.min.js:53
On @ react-dom.production.min.js:100
Fn @ react-dom.production.min.js:101
(anonymous) @ react-dom.production.min.js:113
Ie @ react-dom.production.min.js:292
(anonymous) @ react-dom.production.min.js:50
Bn @ react-dom.production.min.js:105
Xt @ react-dom.production.min.js:75
Zt @ react-dom.production.min.js:74
t.unstable_runWithPriority @ scheduler.production.min.js:18
Hi @ react-dom.production.min.js:122
De @ react-dom.production.min.js:292
Yt @ react-dom.production.min.js:73

So looks like react is preventing the use of prompt and another method will have to be used to implement the import URL functionality when Swagger Editor is used within a docker extension (as mentioned in my previous comment could probably look implementing this is a same way as topbar-insert.jsx).

@n-murphy
Copy link
Owner Author

In version 4.3.0 of the extension I created my own custom swagger-editor image (as mentioned above) where I just commented out the line and thereby the option to import the URL. However I have reverted this change for 4.4.x and instead I've forked the swagger-editor repository and for hacktoberfest I will have a go at trying to fix this or rather get some help with fixing this.

@n-murphy n-murphy removed their assignment Oct 3, 2022
@aslafy-z
Copy link

aslafy-z commented Oct 5, 2022

I was thinking about contributing to the swagger-editor code to fix this up and found it was already done in the next version (v5), see https://editor-next.swagger.io/. This is still in alpha stage (as of today). I'd like to upgrade to this version to try it up. What do you think?

@n-murphy
Copy link
Owner Author

n-murphy commented Oct 9, 2022

Hi @aslafy-z , Thanks for taking an interest in this project. While I'm aware of the next version of the editor I'm a little hesitant to switch over as it's still in the alpha. I would personally like to wait until it out of alpha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants