Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

feat(swagger-ui): use version 3 #24

Closed
rbarilani opened this issue Oct 25, 2017 · 2 comments · Fixed by #78
Closed

feat(swagger-ui): use version 3 #24

rbarilani opened this issue Oct 25, 2017 · 2 comments · Fixed by #78
Assignees
Milestone

Comments

@rbarilani
Copy link
Contributor

rbarilani commented Oct 25, 2017

Use version 3 of swagger-ui

see git branch

Update 26/10/2017

Today I tried to include swagger-ui version 3 with a naif/raw implementation meant to discover:

  • what we can do with v3
  • how we can eventually customize it
  • and .... make it work.

In the process, I removed some code that was not required anymore since the implementation changed. Now the swagger specification is loaded client side where as before was embedded directly as javascript object.
The removed code was mostly about re-rendering the code snippet to embed a new version of the specification when there is a change, now loading and rendering are done client side, so the re-render of the "server-side" code snippet will be irrelevant (it will re-render the same code snippet).
The downside is that I have to include third party libraries also when the swagger_ui tag is not actually used, but I believe that a less connected solution should be possible with the help of hexo's 'hooks', if not, the code will be restored (something like this is also an option).

Some of my findings:

Pros

  • We can use directly the official swagger-ui version instead of the actual angular-boostrap version and including it directly from public cdns
  • swagger-ui styles are already namespaced by being applied just to children of '.swagger-ui' css class, so no more problem about including our custom swagger-ui.css made to avoid conflicts (we can just use the css cdn version), that means also smaller LICENSE to embed
  • UI looks overall nicer
  • Deep linking working quiet nicely (@zmeda this update should solve your issue )
  • Plugins System (I wrote a minimal plugin into a redux action)

Cons

  • With this raw implementation, the performance and reactivity of the page seems to suffer, it seems heavier than v2 angular-bootstrap version, might be misconfiguration. The time to fetch the specification should be also taken into account.

  • Authorize / Dialog UI has to be adjusted heavily to work nicely inside the theme context, as v2

@rbarilani rbarilani self-assigned this Oct 25, 2017
@rbarilani rbarilani added this to the 0.1.0 milestone Oct 25, 2017
@rbarilani rbarilani changed the title swagger-ui: use version 3 feat(swagger-ui): use version 3 Oct 25, 2017
@rbarilani
Copy link
Contributor Author

rbarilani commented Nov 9, 2017

@zmeda Actually deep-linking is possible also with the current swagger-ui 2 implementation, you just have to define "operationId" in your swagger file

rbarilani added a commit that referenced this issue Dec 8, 2017
* feat(swagger): use url spec for v3, remove premature optimization

* refactor(swagger-ui): isolate to run v2 and v3 in parallel
	* isolate css using hexo-swagger-ui-v* namespaces
	* always use snake case for options
	* always use url to "instrument" swagger-ui

* refactor(swagger-ui): minor style adjustments

closes #24
rbarilani added a commit that referenced this issue Dec 8, 2017
* feat(swagger): use url spec for v3, remove premature optimization

* refactor(swagger-ui): isolate to run v2 and v3 in parallel
	* isolate css using hexo-swagger-ui-v* namespaces
	* always use snake case for options
	* always use url to "instrument" swagger-ui

* refactor(swagger-ui): minor style adjustments

closes #24
@rbarilani
Copy link
Contributor Author

blocked by #79

# for free to subscribe to this conversation on GitHub. Already have an account? #.