From 8b01ed9b17f9fe31ae4179d2a48d58e98cc74dc0 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 27 Sep 2023 18:57:27 +0200 Subject: [PATCH] Allow to define expected values in fields definitions --- spec/changelog.yml | 4 ++-- spec/integration/data_stream/fields/fields.spec.yml | 6 ++++++ .../packages/good_v2/data_stream/foo/fields/some_fields.yml | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/spec/changelog.yml b/spec/changelog.yml index de80c7e8..43a52142 100644 --- a/spec/changelog.yml +++ b/spec/changelog.yml @@ -24,9 +24,9 @@ link: https://github.com/elastic/package-spec/pull/607 - version: 2.12.1-next changes: - - description: Prepare for next version + - description: Allow to define expected values in fields definitions. type: enhancement - link: https://github.com/elastic/package-spec/pull/612 + link: https://github.com/elastic/package-spec/pull/616 - version: 2.12.0 changes: - description: Add flag to manifests to indicate if a package or data stream requires root privileges diff --git a/spec/integration/data_stream/fields/fields.spec.yml b/spec/integration/data_stream/fields/fields.spec.yml index 04f6011e..3c3a2e02 100644 --- a/spec/integration/data_stream/fields/fields.spec.yml +++ b/spec/integration/data_stream/fields/fields.spec.yml @@ -92,6 +92,12 @@ spec: description: Short description of field type: string + expected_values: + description: An array of expected values for the field. When defined, these are the only expected values. + type: array + items: + type: string + value: description: The value to associate with a constant_keyword field. type: string diff --git a/test/packages/good_v2/data_stream/foo/fields/some_fields.yml b/test/packages/good_v2/data_stream/foo/fields/some_fields.yml index 6271061c..3c3611dd 100644 --- a/test/packages/good_v2/data_stream/foo/fields/some_fields.yml +++ b/test/packages/good_v2/data_stream/foo/fields/some_fields.yml @@ -86,3 +86,8 @@ metrics: - min - max +- name: enum + type: keyword + expected_values: + - artifact + - directory