sei-protocol / sei-chain

Apache License 2.0
2.67k stars 797 forks source link

Fix for swagger docs serving #1715

Closed dssei closed 3 weeks ago

dssei commented 3 weeks ago

Describe your changes and provide context

Swagger documentation should automatically be registered if api.swagger setting in app.toml is enabled

swagger = true

It was broken though, as this configuration was ignored in the app. Simply adding route would not work either. As just enabling it would pull swagger that is generated in sei-cosmos only lacking some modules APIs. Below solution adds similar capability to sei-chain level and is tweaked to involve ignite generated swagger API docs.

This change:

Testing performed to validate your change

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.79%. Comparing base (8884343) to head (6abc93d).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1715/graphs/tree.svg?width=650&height=150&src=pr&token=DG7ZZJ3PVV&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1715?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) ```diff @@ Coverage Diff @@ ## main #1715 +/- ## ========================================== + Coverage 60.58% 60.79% +0.21% ========================================== Files 370 370 Lines 27422 27433 +11 ========================================== + Hits 16614 16679 +65 + Misses 9672 9614 -58 - Partials 1136 1140 +4 ``` | [Files](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1715?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol) | Coverage Δ | | |---|---|---| | [app/app.go](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1715?src=pr&el=tree&filepath=app%2Fapp.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol#diff-YXBwL2FwcC5nbw==) | `66.19% <83.33%> (+1.22%)` | :arrow_up: | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/sei-protocol/sei-chain/pull/1715/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=sei-protocol)