Skip to content

Commit

Permalink
Fix indices schemas (#750)
Browse files Browse the repository at this point in the history
* Fix indices schemas

Signed-off-by: Thomas Farr <[email protected]>

* changelog

Signed-off-by: Thomas Farr <[email protected]>

* Fix tests

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Dec 20, 2024
1 parent a2afe56 commit edf9d6f
Show file tree
Hide file tree
Showing 12 changed files with 361 additions and 265 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed response schema for `GET /_plugins/_security/api/nodesdn/{cluster_name}` ([#731](https://github.com/opensearch-project/opensearch-api-specification/pull/731))
- Fixed request body for `/_search/scroll/{scroll_id}` ([#732](https://github.com/opensearch-project/opensearch-api-specification/pull/732))
- Fixed type in `_msearch/template` ([#735](https://github.com/opensearch-project/opensearch-api-specification/pull/735))
- Fixed indices API schemas ([#750](https://github.com/opensearch-project/opensearch-api-specification/pull/750))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
208 changes: 99 additions & 109 deletions spec/namespaces/indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -867,8 +867,6 @@ paths:
- $ref: '#/components/parameters/indices.upgrade::query.ignore_unavailable'
- $ref: '#/components/parameters/indices.upgrade::query.only_ancient_segments'
- $ref: '#/components/parameters/indices.upgrade::query.wait_for_completion'
requestBody:
$ref: '#/components/requestBodies/indices.upgrade'
responses:
'200':
$ref: '#/components/responses/indices.upgrade@200'
Expand Down Expand Up @@ -1856,8 +1854,6 @@ paths:
- $ref: '#/components/parameters/indices.upgrade::query.ignore_unavailable'
- $ref: '#/components/parameters/indices.upgrade::query.only_ancient_segments'
- $ref: '#/components/parameters/indices.upgrade::query.wait_for_completion'
requestBody:
$ref: '#/components/requestBodies/indices.upgrade'
responses:
'200':
$ref: '#/components/responses/indices.upgrade@200'
Expand Down Expand Up @@ -1969,8 +1965,7 @@ components:
settings:
description: Configuration options for the target index.
type: object
additionalProperties:
type: object
additionalProperties: true
description: The configuration for the target index (`settings` and `aliases`)
indices.create:
content:
Expand Down Expand Up @@ -2179,8 +2174,7 @@ components:
Configuration options for the index.
Data streams do not support this parameter.
type: object
additionalProperties:
type: object
additionalProperties: true
description: The conditions that needs to be met for executing rollover
indices.shrink:
content:
Expand All @@ -2198,8 +2192,7 @@ components:
settings:
description: Configuration options for the target index.
type: object
additionalProperties:
type: object
additionalProperties: true
description: The configuration for the target index (`settings` and `aliases`)
indices.simulate_index_template:
content:
Expand Down Expand Up @@ -2273,11 +2266,6 @@ components:
$ref: '../schemas/indices.update_aliases.yaml#/components/schemas/Action'
description: The definition of `actions` to perform
required: true
indices.upgrade:
content:
application/json:
schema:
$ref: '../schemas/indices._common.yaml#/components/schemas/UpgradeRequest'
indices.validate_query:
content:
application/json:
Expand All @@ -2292,20 +2280,19 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
shards_acknowledged:
type: boolean
indices:
type: array
items:
$ref: '../schemas/indices.add_block.yaml#/components/schemas/IndicesBlockStatus'
required:
- acknowledged
- indices
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
shards_acknowledged:
type: boolean
indices:
type: array
items:
$ref: '../schemas/indices.add_block.yaml#/components/schemas/IndicesBlockStatus'
required:
- indices
- shards_acknowledged
indices.analyze@200:
content:
application/json:
Expand All @@ -2327,36 +2314,34 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
shards_acknowledged:
type: boolean
required:
- acknowledged
- index
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
shards_acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
required:
- index
- shards_acknowledged
indices.close@200:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
indices:
type: object
additionalProperties:
$ref: '../schemas/indices.close.yaml#/components/schemas/CloseIndexResult'
shards_acknowledged:
type: boolean
required:
- acknowledged
- indices
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
indices:
type: object
additionalProperties:
$ref: '../schemas/indices.close.yaml#/components/schemas/CloseIndexResult'
shards_acknowledged:
type: boolean
required:
- indices
- shards_acknowledged
indices.create@200:
content:
application/json:
Expand Down Expand Up @@ -2633,32 +2618,31 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
conditions:
type: object
additionalProperties:
type: boolean
dry_run:
type: boolean
new_index:
type: string
old_index:
type: string
rolled_over:
type: boolean
shards_acknowledged:
type: boolean
required:
- acknowledged
- conditions
- dry_run
- new_index
- old_index
- rolled_over
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
conditions:
type: object
additionalProperties:
type: boolean
dry_run:
type: boolean
new_index:
type: string
old_index:
type: string
rolled_over:
type: boolean
shards_acknowledged:
type: boolean
required:
- conditions
- dry_run
- new_index
- old_index
- rolled_over
- shards_acknowledged
indices.segments@200:
content:
application/json:
Expand Down Expand Up @@ -2690,18 +2674,17 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
shards_acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
required:
- acknowledged
- index
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
shards_acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
required:
- index
- shards_acknowledged
indices.simulate_index_template@200:
content:
application/json:
Expand All @@ -2725,18 +2708,17 @@ components:
content:
application/json:
schema:
type: object
properties:
acknowledged:
type: boolean
shards_acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
required:
- acknowledged
- index
- shards_acknowledged
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/AcknowledgedResponseBase'
- type: object
properties:
shards_acknowledged:
type: boolean
index:
$ref: '../schemas/_common.yaml#/components/schemas/IndexName'
required:
- index
- shards_acknowledged
indices.stats@200:
content:
application/json:
Expand All @@ -2763,7 +2745,14 @@ components:
content:
application/json:
schema:
$ref: '../schemas/indices._common.yaml#/components/schemas/IndexPostUpgradeStatus'
allOf:
- $ref: '../schemas/_common.yaml#/components/schemas/ShardsOperationResponseBase'
- type: object
properties:
upgraded_indices:
type: object
additionalProperties:
$ref: '../schemas/indices._common.yaml#/components/schemas/UpgradeVersionStatus'
indices.validate_query@200:
content:
application/json:
Expand Down Expand Up @@ -3658,7 +3647,8 @@ components:
Set this parameter to 1 to merge all segments into one segment.
The default behavior is to perform the merge as necessary.
schema:
type: number
type: integer
format: int64
style: form
indices.forcemerge::query.only_expunge_deletes:
in: query
Expand Down Expand Up @@ -4802,10 +4792,10 @@ components:
description: List of shard health statuses used to limit the request.
schema:
oneOf:
- $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/Status'
- $ref: '../schemas/indices.shard_stores.yaml#/components/schemas/ShardStoreStatus'
- type: array
items:
$ref: '../schemas/indices.shard_stores.yaml#/components/schemas/Status'
$ref: '../schemas/indices.shard_stores.yaml#/components/schemas/ShardStoreStatus'
style: form
indices.shrink::path.index:
in: path
Expand Down
Loading

0 comments on commit edf9d6f

Please sign in to comment.