Skip to content
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

[BUG] The response definition for the GET /_snapshot/{repository}/{snapshot} endpoint is incorrect. #606

Closed
hogesako opened this issue Oct 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hogesako
Copy link
Contributor

hogesako commented Oct 8, 2024

What is the bug?

The response from the get snapshot endpoint contains only snapshots.
https://opensearch.org/docs/latest/api-reference/snapshots/get-snapshot/

However, the API definition includes total, responses, and remaining.
https://github.com/opensearch-project/opensearch-api-specification/blob/main/spec/namespaces/snapshot.yaml#L411-L427

Similarly, the definition of SnapshotInfo includes unnecessary duration, index_details, metadata, reason, repository, and feature_states."

SnapshotInfo:
type: object
properties:
data_streams:
type: array
items:
type: string
duration:
$ref: '_common.yaml#/components/schemas/Duration'
duration_in_millis:
$ref: '_common.yaml#/components/schemas/DurationValueUnitMillis'
end_time:
$ref: '_common.yaml#/components/schemas/DateTime'
end_time_in_millis:
$ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis'
failures:
type: array
items:
$ref: '#/components/schemas/SnapshotShardFailure'
include_global_state:
type: boolean
indices:
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'
reason:
type: string
repository:
$ref: '_common.yaml#/components/schemas/Name'
snapshot:
$ref: '_common.yaml#/components/schemas/Name'
shards:
$ref: '_common.yaml#/components/schemas/ShardStatistics'
start_time:
$ref: '_common.yaml#/components/schemas/DateTime'
start_time_in_millis:
$ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis'
state:
type: string
uuid:
$ref: '_common.yaml#/components/schemas/Uuid'
version:
$ref: '_common.yaml#/components/schemas/VersionString'
version_id:
$ref: '_common.yaml#/components/schemas/VersionNumber'
feature_states:
type: array
items:
$ref: '#/components/schemas/InfoFeatureState'

How can one reproduce the bug?

Compare the actual response with requests made to OpenSearch.

What is the expected behavior?

Match spec to what's in the OpenSearch code.

What is your host/environment?

OpenSearch 2.15.0

Do you have any additional context?

opensearch-project/opensearch-java#420

@hogesako hogesako added bug Something isn't working untriaged labels Oct 8, 2024
@dblock
Copy link
Member

dblock commented Oct 8, 2024

@hogesako Thanks for opening this, appreciate a PR if you have time!

@hogesako
Copy link
Contributor Author

Duration, metadata, and reason were described in the source code.
https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/snapshots/SnapshotInfo.java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants