diff --git a/CHANGELOG.md b/CHANGELOG.md index 5df6f9d0e..b5b2f5756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/spec/namespaces/cat.yaml b/spec/namespaces/cat.yaml index 0ea690926..597c77f47 100644 --- a/spec/namespaces/cat.yaml +++ b/spec/namespaces/cat.yaml @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index aa18d7757..139e8290f 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -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 @@ -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: @@ -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: diff --git a/spec/schemas/cat._common.yaml b/spec/schemas/cat.segment_replication.yaml similarity index 64% rename from spec/schemas/cat._common.yaml rename to spec/schemas/cat.segment_replication.yaml index 0c7df33ca..913eaff12 100644 --- a/spec/schemas/cat._common.yaml +++ b/spec/schemas/cat.segment_replication.yaml @@ -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: diff --git a/spec/schemas/cat.snapshots.yaml b/spec/schemas/cat.snapshots.yaml index a13d3a29a..3a430409f 100644 --- a/spec/schemas/cat.snapshots.yaml +++ b/spec/schemas/cat.snapshots.yaml @@ -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: