Skip to content

Commit

Permalink
Add additionalProperties to ErrorCause and fix creation_date type for…
Browse files Browse the repository at this point in the history
… list_dangling_indices (#462)

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Aug 5, 2024
1 parent 59a7ff4 commit 1061972
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions spec/schemas/dangling_indices.list_dangling_indices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tools/src/_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`)
}
Expand Down

0 comments on commit 1061972

Please sign in to comment.