Skip to content
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

chore: remove gov v1beta1 endpoints from docs #3589

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Feb 25, 2025

Remove all /cosmos/gov/v1beta1/ endpoints from the openapi docs. These endpoints have been broken since the sdk v0.47 upgrade. Users should just use the /cosmos/gov/v1/ endpoints which actually work.

Also restore missing upgrade module docs.

Also properly set deprecated option on proto RPCs. This required an upgrading protoc-gen-openapiv2.

Also fully qualified naming (openapi_naming_strategy=fqn) so that models have the same naming style as the cosmos ones.

Also enable inline model display via some SwaggerUIBundle options.

Summary by CodeRabbit

  • Bug Fixes
    • Resolved issues with broken endpoints to ensure the API documentation displays accurate content.
  • Chores
    • Enhanced error handling and updated criteria for endpoint retention, resulting in a more comprehensive API reference.

@gartnera gartnera added the no-changelog Skip changelog CI check label Feb 25, 2025
@gartnera gartnera requested a review from a team as a code owner February 25, 2025 20:56
Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The pull request updates the scripts/protoc-gen-openapi.sh script. The modifications enhance the script's robustness by adding set -eo pipefail for improved error handling. Additionally, a new conditional check has been implemented within the loop processing keys from the merged Swagger file to exclude paths that start with /cosmos/gov/v1beta1. The script's logic for retaining endpoints has also been adjusted to now include the "upgrade" endpoint in addition to the existing "base" and "tx" endpoints.

Changes

File Change Summary
scripts/protoc-gen-openapi.sh - Added set -eo pipefail for error handling
- Added conditional check to exclude paths starting with /cosmos/gov/v1beta1
- Expanded retention criteria to include "upgrade" along with "base" and "tx"

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant S as Script (protoc-gen-openapi.sh)
    participant F as Swagger File
    U->>S: Trigger script execution
    S->>S: Set error handling with 'set -eo pipefail'
    S->>F: Read merged Swagger file
    F-->>S: Provide list of API keys/paths
    S->>S: Loop through each key
    S->>S: Check if key starts with /cosmos/gov/v1beta1
    S->>S: Skip key if check passes, else proceed
    S->>S: Evaluate if key is "base", "tx", or "upgrade"
    S->>S: Retain endpoint if condition met
    S->>U: Output refined OpenAPI documentation
Loading

Suggested reviewers

  • skosito
  • lumtis
  • fbac
  • brewmaster012
  • kingpinXD

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
scripts/protoc-gen-openapi.sh (1)

3-4: Enhance Error Handling with set -eo pipefail
The addition of set -eo pipefail immediately after the shebang is a robust improvement that ensures the script exits on errors and that any failure in a pipe is detected. As a further enhancement, consider also using set -u to treat unset variables as errors, which would make the script even more resilient.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5149422 and 723a85e.

📒 Files selected for processing (1)
  • scripts/protoc-gen-openapi.sh (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.sh`: Review the shell scripts, point out issues relati...

**/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

  • scripts/protoc-gen-openapi.sh
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: lint
  • GitHub Check: build-zetanode
  • GitHub Check: build-and-test
  • GitHub Check: gosec
  • GitHub Check: build
  • GitHub Check: Analyze (go)
🔇 Additional comments (2)
scripts/protoc-gen-openapi.sh (2)

59-64: Exclude Deprecated /cosmos/gov/v1beta1 Endpoints
The new conditional check effectively identifies and removes paths beginning with /cosmos/gov/v1beta1, which satisfies the PR objective by eliminating non-functional endpoints from the generated documentation. The use of yq for in-place deletion is both concise and efficient.


70-73: Retain the "upgrade" Endpoint for API Consistency
Expanding the retention logic to include the "upgrade" endpoint—along with "base" and "tx"—ensures that all relevant endpoints are preserved in the final OpenAPI documentation. This change aligns with the updated documentation requirements and the overall strategy for endpoint management.

@gartnera gartnera enabled auto-merge February 25, 2025 20:58
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.85%. Comparing base (d3eb81c) to head (78cf71e).
Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3589      +/-   ##
===========================================
+ Coverage    64.80%   64.85%   +0.05%     
===========================================
  Files          462      462              
  Lines        31934    31938       +4     
===========================================
+ Hits         20694    20713      +19     
+ Misses       10332    10313      -19     
- Partials       908      912       +4     

see 1 file with indirect coverage changes

@gartnera gartnera force-pushed the remove-gov-v1beta1-endpoints branch from 91c4e7f to aee7a9f Compare February 25, 2025 23:48
@gartnera gartnera force-pushed the remove-gov-v1beta1-endpoints branch from aee7a9f to 78cf71e Compare February 25, 2025 23:50
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:proto no-changelog Skip changelog CI check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants