Skip to content

Conversation

JeremyDahlgren
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the details here, I updated the entry per your suggestion.

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
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 🟢 16/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.

1 similar comment
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 🟢 16/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.

@JeremyDahlgren JeremyDahlgren requested a review from pquentin June 18, 2025 14:11
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.

Thanks! LGTM.

@pquentin pquentin changed the title Add documentation for GET snapshots state query parameter. Add GET snapshots state query parameter Jun 20, 2025
@pquentin pquentin merged commit 07be12f into main Jun 20, 2025
8 checks passed
@pquentin pquentin deleted the jdahlgren/add-get-snapshots-state-query-param branch June 20, 2025 05:52
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

2 participants