From 10619725989a6b614dff93f9d80a8db55d0143d8 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 6 Aug 2024 00:59:35 +1200 Subject: [PATCH] Add additionalProperties to ErrorCause and fix creation_date type for list_dangling_indices (#462) Signed-off-by: Thomas Farr --- CHANGELOG.md | 4 +++- spec/schemas/_common.yaml | 4 ++++ spec/schemas/dangling_indices.list_dangling_indices.yaml | 2 ++ tools/src/_utils/index.ts | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 361b4f8c..2f65144d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,7 +62,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `/_plugins/_ppl`, `explain` and `stats` ([#460](https://github.com/opensearch-project/opensearch-api-specification/pull/460)) - Added tests against OpenSearch 3.0 ([#459](https://github.com/opensearch-project/opensearch-api-specification/pull/459)) - Added support for request headers in tests [#461](https://github.com/opensearch-project/opensearch-api-specification/pull/461) - +- Added metadata additionalProperties to `ErrorCause` ([#462](https://github.com/opensearch-project/opensearch-api-specification/pull/462)) +- Added `creation_date` field to `DanglingIndex` ([#462](https://github.com/opensearch-project/opensearch-api-specification/pull/462)) + ### Changed - Replaced Smithy with a native OpenAPI spec ([#189](https://github.com/opensearch-project/opensearch-api-specification/issues/189)) diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index afb4b6d1..1c20ad16 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -139,6 +139,7 @@ components: UnitMillis: description: Time unit for milliseconds. type: number + format: int64 DurationLarge: description: |- A date histogram interval. Similar to `Duration` with additional units: `w` (week), `M` (month), `q` (quarter) and `y` (year). @@ -314,6 +315,9 @@ components: $ref: '#/components/schemas/ErrorCause' required: - type + additionalProperties: + title: metadata + description: Additional details about the error. DurationValueUnitNanos: allOf: - $ref: '#/components/schemas/UnitNanos' diff --git a/spec/schemas/dangling_indices.list_dangling_indices.yaml b/spec/schemas/dangling_indices.list_dangling_indices.yaml index b9775aa5..a9f3a42c 100644 --- a/spec/schemas/dangling_indices.list_dangling_indices.yaml +++ b/spec/schemas/dangling_indices.list_dangling_indices.yaml @@ -13,6 +13,8 @@ components: type: string index_uuid: type: string + creation_date: + $ref: '_common.yaml#/components/schemas/DateTime' creation_date_millis: $ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis' node_ids: diff --git a/tools/src/_utils/index.ts b/tools/src/_utils/index.ts index 3278e14c..5177fd86 100644 --- a/tools/src/_utils/index.ts +++ b/tools/src/_utils/index.ts @@ -53,7 +53,7 @@ export function determine_possible_schema_types (doc: OpenAPIV3.Document, schema if (schema?.anyOf !== undefined) return collect_all(schema.anyOf) if (schema?.oneOf !== undefined) return collect_all(schema.oneOf) - if (schema == null || Object.keys(schema).filter(k => k !== 'description').length == 0) return SCHEMA_OBJECT_TYPES + if (schema == null || Object.keys(schema).filter(k => k !== 'description' && k !== 'title').length == 0) return SCHEMA_OBJECT_TYPES throw new Error(`Unable to determine possible types of schema: ${to_json(schema)}`) }