Skip to content

Commit 141c83e

Browse files
authored
Add null value and Setting type (#2478)
1 parent b92b9e1 commit 141c83e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

specification/_spec_utils/utils.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Stringified } from '@spec_utils/Stringified'
21+
22+
/**
23+
* A `null` value that is to be interpreted as an actual value, unless other uses of `null` that are equivalent
24+
* to a missing value. It is used for exemple in settings, where using the `NullValue` for a setting will reset
25+
* it to its default value.
26+
*/
27+
type NullValue = null
28+
29+
/**
30+
* Settings in Elasticsearch are values that can be reset to their default by setting them to the `null` value.
31+
*
32+
* @es_quirk Because of how they are implemented internally, settings are always returned as strings, even
33+
* if their value has been set using a primitive type.
34+
*/
35+
type Setting<T> = Stringified<T> | NullValue

0 commit comments

Comments
 (0)