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

Fix CAT schemas #769

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed schema validation for invalid properties in `retry` configuration ([#758](https://github.com/opensearch-project/opensearch-api-specification/pull/758))
- Fixed nodes API schemas ([#761](https://github.com/opensearch-project/opensearch-api-specification/pull/761))
- Fixed ingest API schemas ([#766](https://github.com/opensearch-project/opensearch-api-specification/pull/766))
- Fixed CAT API schemas ([#769](https://github.com/opensearch-project/opensearch-api-specification/pull/769))

### 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
10 changes: 4 additions & 6 deletions spec/namespaces/cat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ components:
schema:
type: array
items:
$ref: '../schemas/cat._common.yaml#/components/schemas/CatPitSegmentsRecord'
$ref: '../schemas/cat.segments.yaml#/components/schemas/SegmentsRecord'
cat.allocation@200:
content:
text/plain:
Expand Down Expand Up @@ -959,7 +959,7 @@ components:
schema:
type: array
items:
$ref: '../schemas/cat._common.yaml#/components/schemas/CatPitSegmentsRecord'
$ref: '../schemas/cat.segments.yaml#/components/schemas/SegmentsRecord'
cat.plugins@200:
content:
text/plain:
Expand Down Expand Up @@ -999,7 +999,7 @@ components:
schema:
type: array
items:
$ref: '../schemas/cat._common.yaml#/components/schemas/CatSegmentReplicationRecord'
$ref: '../schemas/cat.segment_replication.yaml#/components/schemas/SegmentReplicationRecord'
cat.segments@200:
content:
text/plain:
Expand Down Expand Up @@ -1804,9 +1804,7 @@ components:
name: full_id
description: When `true`, returns the full node ID. When `false`, returns the shortened node ID.
schema:
anyOf:
- type: boolean
- type: string
$ref: '../schemas/_common.yaml#/components/schemas/StringifiedBoolean'
default: false
style: form
cat.nodes::query.h:
Expand Down
94 changes: 53 additions & 41 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -819,19 +819,37 @@ components:
type: string
pattern: '(?:(-1)|(0)|\d+(\.\d+)?(b|kb|k|mb|m|gb|g|tb|t|pb|p))'
ByteUnit:
type: string
enum:
- b
- g
- gb
- k
- kb
- m
- mb
- p
- pb
- t
- tb
# eslint-disable yml/sort-sequence-values -- The order of `kb` & `k` etc. is important for preferring the more correct variant.
oneOf:
- title: bytes
type: string
const: b
- title: kilo_bytes
type: string
enum:
- kb
- k
- title: mega_bytes
type: string
enum:
- mb
- m
- title: giga_bytes
type: string
enum:
- gb
- g
- title: tera_bytes
type: string
enum:
- tb
- t
- title: peta_bytes
type: string
enum:
- pb
- p
# eslint-enable yml/sort-sequence-values
ByteCount:
type: integer
format: int64
Expand Down Expand Up @@ -866,15 +884,28 @@ components:
description: Time of day, expressed as HH:MM:SS.
type: string
TimeUnit:
type: string
enum:
- d
- h
- m
- micros
- ms
- nanos
- s
oneOf:
- title: nanoseconds
type: string
const: nanos
- title: microseconds
type: string
const: micros
- title: milliseconds
type: string
const: ms
- title: seconds
type: string
const: s
- title: minutes
type: string
const: m
- title: hours
type: string
const: h
- title: days
type: string
const: d
HealthStatus:
# eslint-disable yml/sort-sequence-values
oneOf:
Expand All @@ -899,25 +930,6 @@ components:
- red
- RED
# eslint-enable yml/sort-sequence-values
ScheduleTimeOfDay:
description: A time of day, expressed either as `hh:mm`, `noon`, `midnight`, or an hour/minutes structure.
oneOf:
- type: string
- $ref: '#/components/schemas/HourAndMinute'
HourAndMinute:
type: object
properties:
hour:
type: array
items:
type: number
minute:
type: array
items:
type: number
required:
- hour
- minute
Uuid:
type: string
ScrollIds:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
openapi: 3.1.0
info:
title: Schemas of `cat._common` Category
description: Schemas of `cat._common` category.
title: Schemas of `cat.segment_replication` Category
description: Schemas of `cat.segment_replication` category.
version: 1.0.0
paths: {}
components:
schemas:
CatPitSegmentsRecord:
type: object
properties:
index:
type: string
shard:
type: string
prirep:
type: string
ip:
type: string
segment:
type: string
generation:
type: string
docs.count:
type: string
docs.deleted:
type: string
size:
type: string
size.memory:
type: string
committed:
type: string
searchable:
type: string
version:
type: string
compound:
type: string
CatSegmentReplicationRecord:
SegmentReplicationRecord:
type: object
properties:
shardId:
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/cat.snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ components:
start_epoch:
$ref: '_common.yaml#/components/schemas/StringifiedEpochTimeUnitSeconds'
start_time:
$ref: '_common.yaml#/components/schemas/ScheduleTimeOfDay'
$ref: '_common.yaml#/components/schemas/TimeOfDay'
end_epoch:
$ref: '_common.yaml#/components/schemas/StringifiedEpochTimeUnitSeconds'
end_time:
Expand Down
Loading