Skip to content

Commit

Permalink
fix spec snapshot endpoint (#608)
Browse files Browse the repository at this point in the history
* fix spec snapshot endpoint

Signed-off-by: Tatsuya Kawakami <[email protected]>

* fix lint and add changelog

Signed-off-by: Tatsuya Kawakami <[email protected]>

---------

Signed-off-by: Tatsuya Kawakami <[email protected]>
  • Loading branch information
hogesako authored Oct 11, 2024
1 parent 49b7c68 commit 5dc65a5
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed inaccurate numeric type ([#597](https://github.com/opensearch-project/opensearch-api-specification/pull/597))([#598](https://github.com/opensearch-project/opensearch-api-specification/pull/598))([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600))
- Fixed mapping and analysis types ([#600](https://github.com/opensearch-project/opensearch-api-specification/pull/600))
- Fixed `RestStatus` responses in `DELETE /_plugins/_notifications/configs/{config_id}` ([#594](https://github.com/opensearch-project/opensearch-api-specification/pull/594))
- Fixed `GET /_snapshot_/{repository}/{snapshot}` ([#608](https://github.com/opensearch-project/opensearch-api-specification/pull/608))

### Security

Expand Down
13 changes: 1 addition & 12 deletions spec/namespaces/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -408,23 +408,12 @@ components:
schema:
type: object
properties:
responses:
type: array
items:
$ref: '../schemas/snapshot.get.yaml#/components/schemas/SnapshotResponseItem'
snapshots:
type: array
items:
$ref: '../schemas/snapshot._common.yaml#/components/schemas/SnapshotInfo'
total:
description: The total number of snapshots that match the request when ignoring size limit or after query parameter.
type: number
remaining:
description: The number of remaining snapshots that were not returned due to size limits and that can be fetched by additional requests using the next field value.
type: number
required:
- remaining
- total
- snapshots
snapshot.get_repository@200:
content:
application/json:
Expand Down
39 changes: 4 additions & 35 deletions spec/schemas/snapshot._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ components:
type: array
items:
$ref: '_common.yaml#/components/schemas/IndexName'
index_details:
type: object
additionalProperties:
$ref: '#/components/schemas/IndexDetails'
metadata:
$ref: '_common.yaml#/components/schemas/Metadata'
pinned_timestamp:
$ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis'
reason:
type: string
repository:
$ref: '_common.yaml#/components/schemas/Name'
remote_store_index_shallow_copy:
type: boolean
snapshot:
$ref: '_common.yaml#/components/schemas/Name'
shards:
Expand All @@ -57,10 +55,6 @@ components:
$ref: '_common.yaml#/components/schemas/VersionString'
version_id:
$ref: '_common.yaml#/components/schemas/VersionNumber'
feature_states:
type: array
items:
$ref: '#/components/schemas/InfoFeatureState'
required:
- data_streams
- snapshot
Expand All @@ -83,31 +77,6 @@ components:
- reason
- shard_id
- status
IndexDetails:
type: object
properties:
shard_count:
type: number
size:
$ref: '_common.yaml#/components/schemas/HumanReadableByteCount'
size_in_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
max_segments_per_shard:
type: number
required:
- max_segments_per_shard
- shard_count
- size_in_bytes
InfoFeatureState:
type: object
properties:
feature_name:
type: string
indices:
$ref: '_common.yaml#/components/schemas/Indices'
required:
- feature_name
- indices
Repository:
type: object
properties:
Expand Down
21 changes: 0 additions & 21 deletions spec/schemas/snapshot.get.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions tests/snapshot/snapshot/snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _snapshot/{repository}/snapshot endpoints.
epilogues:
- path: /_snapshot/{repository}/{snapshot}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
- path: /_snapshot/{repository}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
prologues:
- path: /_snapshot/{repository}
method: PUT
parameters:
repository: my-fs-repository
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
chapters:
- synopsis: Get information about a repository.
path: /_snapshot/{repository}
method: GET
parameters:
repository: my-fs-repository
response:
status: 200
payload:
my-fs-repository:
type: fs
settings:
location: /tmp/opensearch/repo
- synopsis: Create a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: PUT
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
wait_for_completion: true
request:
payload:
indices: '*'
ignore_unavailable: true
include_global_state: false
partial: true
response:
status: 200
payload:
snapshot:
snapshot: my-test-snapshot
- synopsis: Get information about a snapshot.
path: /_snapshot/{repository}/{snapshot}
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
- synopsis: Get information about a snapshot with human-readable parameter.
path: /_snapshot/{repository}/{snapshot}
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
human: true
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot

0 comments on commit 5dc65a5

Please sign in to comment.