Skip to content

Add documentation for GET snapshots state query parameter. #4597

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JeremyDahlgren
Copy link

Adds documentation for the SnapshotState enum and state query parameter added in elasticsearch PR 128635.

Adds documentation for the SnapshotState enum and state
query parameter added in elasticsearch PR #128635.
@JeremyDahlgren JeremyDahlgren requested a review from pquentin June 17, 2025 13:21
@JeremyDahlgren JeremyDahlgren added the skip-backport This pull request should not be backported label Jun 17, 2025
@JeremyDahlgren JeremyDahlgren marked this pull request as ready for review June 17, 2025 13:23
Copy link
Contributor

Following you can find the validation results for the APIs you have changed.

API Status Request Response
snapshot.cleanup_repository 🟢 3/3 3/3
snapshot.clone 🟢 5/5 5/5
snapshot.create_repository 🔴 24/29 29/29
snapshot.create 🟢 30/30 30/30
snapshot.delete_repository 🟢 10/10 10/10
snapshot.delete 🔴 22/24 24/24
snapshot.get_repository 🔴 19/19 7/19
snapshot.get 🔴 15/16 16/16
snapshot.repository_analyze Missing test Missing test
snapshot.repository_verify_integrity Missing test Missing test
snapshot.restore 🟢 5/5 5/5
snapshot.status 🟢 2/2 2/2
snapshot.verify_repository 🟢 2/2 2/2

You can validate these APIs yourself by using the make validate target.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thank you! Note that the Elasticsearch specification has multiple uses, and documentation is only one of them. The original goal was to generate Elasticsearch clients, and this is how we generate 7 of our clients now.

Comment on lines +151 to +158
/**
* Only return snapshots with a state found in the given comma-separated list of snapshot states.
* The default is all snapshot states.
* @server_default All snapshot states
* @availability stack since=9.1.0
* @availability serverless
*/
state?: SnapshotState
Copy link
Member

Choose a reason for hiding this comment

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

For better user experience, comma-separated values in query parameters are exposed as lists in Elasticsearch clients, so we should allow SnapshotState but also SnapshotState[], as shown below. I had to remove the default value line too because of this error: Error: Default values in unions can only be configured for instance_of types, you are using union_of.

Suggested change
/**
* Only return snapshots with a state found in the given comma-separated list of snapshot states.
* The default is all snapshot states.
* @server_default All snapshot states
* @availability stack since=9.1.0
* @availability serverless
*/
state?: SnapshotState
/**
* Only return snapshots with a state found in the given comma-separated list of snapshot states.
* The default is all snapshot states.
* @availability stack since=9.1.0
* @availability serverless
*/
state?: SnapshotState | SnapshotState[]

With this change, validation passes for snapshot.get, as you will see in the GitHub comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-backport This pull request should not be backported specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants