-
Notifications
You must be signed in to change notification settings - Fork 41
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
Update swagger generation for 1.19 #2070
Conversation
* Mark v1.19.0-rc1 in the changelog. * Create release changelog.
WalkthroughThe recent changes across multiple files improve the Swagger API documentation, replace the outdated statik tool with Go's native embed package, and refine the Go build process. These updates ensure better API method categorization, modern dependency handling, and an updated Swagger UI, enhancing the usability and maintainability of the codebase. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
go.sum
is excluded by!**/*.sum
Files selected for processing (11)
- .golangci.yml (1 hunks)
- CHANGELOG.md (1 hunks)
- Makefile (2 hunks)
- app/app.go (6 hunks)
- client/docs/config.json (3 hunks)
- client/docs/embed.go (1 hunks)
- client/docs/swagger-ui/oauth2-redirect.html (4 hunks)
- contrib/devtools/Makefile (4 hunks)
- contrib/githooks/pre-commit (1 hunks)
- go.mod (1 hunks)
- scripts/protoc-swagger-gen.sh (1 hunks)
Files skipped from review due to trivial changes (2)
- .golangci.yml
- go.mod
Additional comments not posted (17)
client/docs/embed.go (1)
1-6
: LGTM! The use of Go embed is appropriate.The Go embed package is correctly used to embed the
swagger-ui
directory.contrib/githooks/pre-commit (1)
28-30
: LGTM! The exclusion of generated files is appropriate.The changes ensure that generated files are not formatted, which is a good practice.
scripts/protoc-swagger-gen.sh (1)
32-38
: LGTM! The changes to the swagger generation process are appropriate.The updates to combine swagger files and strip specific tags improve the organization of the generated files.
client/docs/swagger-ui/oauth2-redirect.html (2)
3-5
: LGTM! The addition of the<head>
section is appropriate.Adding the
<head>
section is a good practice for HTML documents.
16-27
: LGTM! The improvements to the script conditions are appropriate.The changes enhance the JavaScript logic and improve readability.
contrib/devtools/Makefile (1)
53-53
: Approved: Removal ofstatik
tool installation logic.The removal aligns with the PR objectives. Ensure no additional dependencies on
statik
remain.client/docs/config.json (4)
5-5
: Approved: Update of description.The description change to "Provenance Blockchain Protocol API" aligns with the PR objectives.
6-6
: Approved: Update of version.The version update to "1.19.0" aligns with the PR objectives.
11-15
: Approved: Addition of tags for endpoints.The addition of tags improves the organization of the Swagger documentation.
Also applies to: 23-28, 32-36, 44-49, 52-57, 60-65, 69-73, 81-86, 90-94, 104-109, 113-117, 126-131, 135-139, 147-152, 156-160, 168-173, 176-181, 184-189, 193-197, 205-210, 213-218, 221-226, 229-234, 237-242, 245-258
249-257
: Approved: Addition of "Cosmos SDK" tag and exclusion of "cosmos/nft/.*" path.These changes align with the PR objectives of improving method grouping and documentation.
Makefile (2)
290-290
: Approved: Update of formatting command.The changes align with the PR objectives of updating the build process and excluding specific paths.
292-292
: Approved: Update ofgoimports
command.The changes improve the formatting process and align with the PR objectives.
app/app.go (4)
6-6
: Import statement forio/fs
looks good.The addition of
io/fs
is necessary for the new implementation of theRegisterSwaggerAPI
function.
140-140
: Import statement forgithub.com/provenance-io/provenance/client/docs
looks good.The addition of
client/docs
is necessary for embedding the Swagger UI files.
1322-1323
: Function signature change looks good.The function signature of
RegisterSwaggerAPI
was modified to include aswaggerEnabled
boolean parameter and return an error. This change is necessary for the new Swagger generation process.
1324-1336
: New implementation ofRegisterSwaggerAPI
looks good.The function now conditionally registers the Swagger API based on the
swaggerEnabled
parameter and handles errors appropriately. The use ofio/fs
andclient/docs
is correct for embedding the Swagger UI files.CHANGELOG.md (1)
48-48
: Changelog entry looks good.The entry for updating the Swagger API documentation is clear and follows the existing format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- Makefile (3 hunks)
- client/docs/README.md (1 hunks)
Files skipped from review due to trivial changes (1)
- client/docs/README.md
Files skipped from review as they are similar to previous changes (1)
- Makefile
* Mark v1.19.0-rc1. (#2051) * Mark v1.19.0-rc1 in the changelog. * Create release changelog. * remove statik for go:embed * updated swagger-ui components * updated swagger gen to filter extra tags * fix changelog * remove release changelog that should not be on main * fix spelling error in comment * update swagger makefile generation references --------- Co-authored-by: Daniel Wedul <[email protected]>
* Mark v1.19.0-rc1. (#2051) * Mark v1.19.0-rc1 in the changelog. * Create release changelog. * remove statik for go:embed * updated swagger-ui components * updated swagger gen to filter extra tags * fix changelog * remove release changelog that should not be on main * fix spelling error in comment * update swagger makefile generation references --------- Co-authored-by: Ira Miller <[email protected]>
Description
This PR updates the swagger generation to use the new format that removes statik and switches to native go embed. It also updates the description, target version (from 1.13 to 1.19), and changes the tagging of method endpoints to they are grouped by module and Cosmos SDK instead of a large list of "Query" and "Service" endpoints.
closes: #2063
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passesSummary by CodeRabbit
New Features
swagger-ui
directory.Refactor
RegisterSwaggerAPI
function signature to include aswaggerEnabled
parameter.protoc-swagger-gen.sh
.Chores
statik
tool and related dependencies, simplifying project configuration.