From 6cdd8b7e86e2a2a08c07929f049d3ed17231b646 Mon Sep 17 00:00:00 2001 From: "Daniel (dB.) Doubrovkine" Date: Thu, 8 Aug 2024 17:04:32 -0400 Subject: [PATCH] Fix: durations are not always integers. (#479) Signed-off-by: dblock --- CHANGELOG.md | 3 ++- spec/schemas/_common.yaml | 2 +- tools/tests/tester/fixtures/specs/excerpt.yaml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5590437..a0ecf4f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,7 +107,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed `/_mapping` with `index` in query ([#385](https://github.com/opensearch-project/opensearch-api-specification/pull/385)) - Fixed duplicate `/_nodes/{node_id}` path ([#416](https://github.com/opensearch-project/opensearch-api-specification/pull/416)) - Fixed `_source` accepting an array of fields in `/_search` ([#430](https://github.com/opensearch-project/opensearch-api-specification/pull/430)) -- Fixed `_update_by_query` with a simple term ([451](https://github.com/opensearch-project/opensearch-api-specification/pull/451)) +- Fixed `_update_by_query` with a simple term ([#451](https://github.com/opensearch-project/opensearch-api-specification/pull/451)) +- Fixed `Duration` to allow for non-integers ([#479](https://github.com/opensearch-project/opensearch-api-specification/pull/479)) ### Security diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 1c20ad16..5b645eed 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -38,7 +38,7 @@ components: description: |- A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. - pattern: ^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$ + pattern: ^([0-9\.]+)(?:d|h|m|s|ms|micros|nanos)$ type: string Metadata: type: object diff --git a/tools/tests/tester/fixtures/specs/excerpt.yaml b/tools/tests/tester/fixtures/specs/excerpt.yaml index 64ad01d3..244e7e46 100644 --- a/tools/tests/tester/fixtures/specs/excerpt.yaml +++ b/tools/tests/tester/fixtures/specs/excerpt.yaml @@ -286,5 +286,5 @@ components: description: |- A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value. - pattern: ^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$ + pattern: ^([0-9\.]+)(?:d|h|m|s|ms|micros|nanos)$ type: string \ No newline at end of file