Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions output/openapi/elasticsearch-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 50 additions & 1 deletion output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions output/schema/validation-errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@
],
"response": []
},
"snapshot.get": {
"request": [
"Request: missing json spec query parameter 'state'"
],
"response": []
},
"snapshot.repository_analyze": {
"request": [
"Request: query parameter 'register_operation_count' does not exist in the json spec"
Expand Down
3 changes: 3 additions & 0 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions specification/snapshot/_types/SnapshotState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export enum SnapshotState {
/** The snapshot process has started. */
IN_PROGRESS,
/** The snapshot process completed successfully. */
SUCCESS,
/** The snapshot failed. */
FAILED,
/** The snapshot was partially successful. */
PARTIAL,
/** The snapshot is incompatible with the current version of the cluster. */
INCOMPATIBLE
}
9 changes: 9 additions & 0 deletions specification/snapshot/get/SnapshotGetRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { integer } from '@_types/Numeric'
import { SortOrder } from '@_types/sort'
import { Duration } from '@_types/Time'
import { SnapshotSort } from '@snapshot/_types/SnapshotInfo'
import { SnapshotState } from '@snapshot/_types/SnapshotState'

/**
* Get snapshot information.
Expand Down Expand Up @@ -147,6 +148,14 @@ export interface Request extends RequestBase {
* @availability serverless
*/
sort?: SnapshotSort
/**
* 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.

/**
* If `true`, returns additional information about each snapshot such as the version of Elasticsearch which took the snapshot, the start and end times of the snapshot, and the number of shards snapshotted.
*
Expand Down