Skip to content

rename API fields to snake_case#20351

Open
05Har-sh wants to merge 1 commit intoopensearch-project:mainfrom
05Har-sh:fix/recovery-api-snakecase
Open

rename API fields to snake_case#20351
05Har-sh wants to merge 1 commit intoopensearch-project:mainfrom
05Har-sh:fix/recovery-api-snakecase

Conversation

@05Har-sh
Copy link
Copy Markdown

@05Har-sh 05Har-sh commented Jan 1, 2026

Description

This PR updates several field names in the /{index}/_recovery API response from camelCase to snake_case to maintain consistency
I have verified these changes by running RecoverySourceTests locally and the build was successful

Related Issues

Fixes #16334

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Summary by CodeRabbit

  • Updates
    • Standardized JSON output for recovery operations to use snake_case field names, improving consistency of API responses.

✏️ Tip: You can customize this high-level summary in your review settings.

@05Har-sh 05Har-sh requested a review from a team as a code owner January 1, 2026 12:30
@github-actions github-actions bot added bug Something isn't working good first issue Good for newcomers Other Storage:Snapshots labels Jan 1, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 1, 2026

📝 Walkthrough

Walkthrough

Updated JSON field names in SnapshotRecoverySource and RemoteStoreRecoverySource to use snake_case in XContent serialization for five properties: restoreUUID, isSearchableSnapshot, remoteStoreIndexShallowCopy, sourceRemoteStoreRepository, and sourceRemoteTranslogRepository.

Changes

Cohort / File(s) Summary
Recovery Source JSON Serialization
server/src/main/java/org/opensearch/cluster/routing/RecoverySource.java
Renamed five JSON output field names in XContent serialization from camelCase to snake_case: restoreUUIDrestore_uuid, isSearchableSnapshotis_searchable_snapshot, remoteStoreIndexShallowCopyremote_store_index_shallow_copy, sourceRemoteStoreRepositorysource_remote_store_repository, sourceRemoteTranslogRepositorysource_remote_translog_repository. No read-path, internal field name, or write-path changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop, a skip, from camel to snake,

Fields now lean, no casing mistake,
Underscores hum where capitals played,
Recovery output tidy, neatly relayed.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the primary change: renaming API field names from camelCase to snake_case, which is the main objective of the PR.
Description check ✅ Passed The description follows the template structure, provides a clear explanation of changes, references the related issue #16334, and completes the checklist with appropriate selections.
Linked Issues check ✅ Passed The PR successfully addresses issue #16334 by converting camelCase field names (restoreUUID, isSearchableSnapshot, remoteStoreIndexShallowCopy, sourceRemoteStoreRepository, sourceRemoteTranslogRepository) to snake_case in the /{index}/_recovery API response.
Out of Scope Changes check ✅ Passed All changes in the PR are directly scoped to renaming field names in RecoverySource.java for the /{index}/_recovery API response, with no extraneous modifications beyond the stated objectives.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b04a647 and b047b22.

📒 Files selected for processing (1)
  • server/src/main/java/org/opensearch/cluster/routing/RecoverySource.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/src/main/java/org/opensearch/cluster/routing/RecoverySource.java

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Harsh Pardeshi <pardeshiharsh005@gmail.com>
@05Har-sh 05Har-sh force-pushed the fix/recovery-api-snakecase branch from b04a647 to b047b22 Compare January 1, 2026 12:42
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 1, 2026

❌ Gradle check result for b047b22: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@05Har-sh
Copy link
Copy Markdown
Author

05Har-sh commented Jan 1, 2026

/check-pull-request

@rick2244
Copy link
Copy Markdown

rick2244 commented Jan 9, 2026

Hi! I’m interested in working on this issue.
I plan to update the API response fields to snake_case and verify changes with RecoverySourceTests.
Please let me know if this is still available.

@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added the stalled Issues that have stalled label Feb 9, 2026
.field("remote_store_index_shallow_copy", remoteStoreIndexShallowCopy)
.field("source_remote_store_repository", sourceRemoteStoreRepository)
.field("source_remote_translog_repository", sourceRemoteTranslogRepository);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The only problem with this change is backward compatibility, which will break.
We can revisit this change ahead of 4.0 release once as we avoid any breaking changes in minor releases.

Copy link
Copy Markdown
Author

@05Har-sh 05Har-sh Feb 10, 2026

Choose a reason for hiding this comment

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

Thank you for the review! I understand the concern regarding backward compatibility. I'm happy to revisit this for the 4.0 release, Please let me know if there are any other adjustments needed in the meantime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers Other Storage:Snapshots v4.0.0

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG] The /{index}/_recovery API returns responses in a non-standard format(using camelCase).

3 participants