pb33f / openapi-changes

The world's sexiest OpenAPI breaking changes detector. Discover what changed between two OpenAPI specs, or a single spec over time. Supports OpenAPI 3.1, 3.0 and Swagger
https://pb33f.io/openapi-changes/
Other
180 stars 16 forks source link

offline mode support #70

Open matankila opened 1 year ago

matankila commented 1 year ago

hey,

i am trying to implement your product in internal private network with no access to outer world.

I talked to @daveshanley on the discord channel and he told me that the product main purpose is to work offline. but it still seems to want to go to the cdn. He also said that the ui model should be replaced to be like in wiretap.

when looking into the bundlejs (/ui/build/static/bundle.js) it contains a reference of the cdn

https://raw.githubusercontent.com/pb33f/openapi-changes/03c1ddd51a4ea6d6dfc8045a294a30d119a30d29/html-report/ui/build/static/bundle.js

eyals24 commented 1 year ago

I faced the same issue. Any solution or workaround ?

daveshanley commented 1 year ago

this is a bug and should not be loading it remotely.

daveshanley commented 1 year ago

Hi Folks,

I have investigated this and I am struggling to re-create the issue using the latest (v0.0.43) of openapi-changes

from the sample-specs folder, running the command openapi-changes html-report petstorev3-original.json petstorev3.json produces a report that makes no network requests for JS. The report file is large (2.7mb)

Here is what I see.

Screenshot 2023-10-19 at 12 34 03 PM

This is the expected behavior, the JS is inlined inside the report HTML.

To enable the CDN mode, use the -c flag like so: openapi-changes html-report petstorev3-original.json petstorev3.json -c

And the generated report will be much, much smaller at 143kb.

When loaded in a browser:

Screenshot 2023-10-19 at 12 38 51 PM

As expected, the CSS and JS are loaded remotely from github pages.

Can you help me re-create this issue? Behavior is as I expect.

matankila commented 1 year ago

Hey @daveshanley,

It does make outer request even on the first example when you go ‘explore tree’ and then explore one of the diffs.. (and then of course the diff itself won’t load).

Thanks 💪🏻

daveshanley commented 1 year ago

I see what you see now, this is absolutely a bug, none of that should be pulled in remotely.

matankila commented 12 months ago

I see what you see now, this is absolutely a bug, none of that should be pulled in remotely.

Is there any expectation to what time the fix will Be available @daveshanley

daveshanley commented 12 months ago

I spent a little while trying to get webpack to inline the JS, it was not having it. This is a more complex fix than I would like it to be, because in order to make this work correctly, there needs to be more jiggling with webpack to get it to behave correctly, or a rebuild / replacement of monaco or webpack.

I am working on the core libopenapi library at the moment, I won't. have any bandwidth to look into this for a few weeks at least.