feat: more options for UI middleware#278
Merged
fredbi merged 1 commit intogo-openapi:masterfrom Dec 12, 2023
Merged
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #278 +/- ##
==========================================
+ Coverage 80.83% 82.04% +1.20%
==========================================
Files 44 45 +1
Lines 3366 3420 +54
==========================================
+ Hits 2721 2806 +85
+ Misses 535 501 -34
- Partials 110 113 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
- refactored UI middleware
* factorized chore middleware to remove duplicated code
* factorized UI middleware options: to avoid breaking changes in the
options types, there is a decode/encode to a common structure
* added more options:
* allows to fully customize the UI template
* added more unit tests
- Spec middleware: added support for optional SpecOption argument
* allows to serve the spec from a custom path / document name
- serving with or without trailing "/" (cf. issue go-openapi#238)
* replaced path.Join() by path.Clean(), which is the intended behavior
(i.e. serve the path, irrespective of the presence of a trailing
slash)
* generalized this behavior to all UI and Spec middleware, not just
swaggerUI
- API Context:
* exposed middleware to serve RapiDoc UI
* allowed new UIOption (...UIOption) to the APIHandler, etc middleware
* coordinated UI / Spec middleware to be consistent when non-default
path/document URL is served
* fixes go-openapi#192
* fixes go-openapi#226
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
a4550bc to
f3145ae
Compare
youyuanwu
approved these changes
Dec 12, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactored UI middleware
Spec middleware: added support for optional SpecOption argument
serving with or without trailing "/" (cf. issue Swagger Middleware drops trailing slash and can't find path #238)
API Context: