Skip to content

Commit 4894e6d

Browse files
github-actions[bot]Anaethelionswallez
authored
[compiler] Rename external to typed_keys_quirk (#4619) (#4622)
* rename external to typed_keys_quirk in compiler * propagate renaming to the specification files * adapt the documentation to reflect the new name * enhance typed_keys_quirk warning usage for contributors --------- (cherry picked from commit d2baac0) Co-authored-by: Laurent Saint-Félix <[email protected]> Co-authored-by: Sylvain Wallez <[email protected]>
1 parent b24f175 commit 4894e6d

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

compiler/src/model/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ export function parseVariantsTag (jsDoc: JSDoc[]): model.Variants | undefined {
10941094
const nonExhaustive = (typeof tags.non_exhaustive === 'string') ? true : undefined
10951095

10961096
const [type, ...values] = tags.variants.split(' ')
1097-
if (type === 'external') {
1097+
if (type === 'typed_keys_quirk') {
10981098
return {
10991099
kind: 'external_tag',
11001100
nonExhaustive: nonExhaustive

docs/modeling-guide.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,9 @@ type FooOrBar = Foo | Bar
332332
333333
An example of internal variants are the type mapping properties.
334334
335-
#### External
335+
#### typed_keys_quirk
336+
337+
**Note**: this feature exists because of some early Elasticsearch APIs where tagging was forgotten, and added after the fact using this quirk to avoid breaking compatibility. **It should not be used for new APIs.**
336338
337339
The key that defines the variant is external to the definition, like in the
338340
case of aggregations in responses or suggesters.
@@ -343,15 +345,15 @@ name in the definition itself.
343345
The syntax is:
344346
345347
```ts
346-
/** @variants external */
348+
/** @variants typed_keys_quirk */
347349

348350
/** @variant name='<field-name>' */
349351
```
350352

351353
For example:
352354

353355
```ts
354-
/** @variants external */
356+
/** @variants typed_keys_quirk */
355357
type FooAlias = Faz | Bar
356358

357359
/** @variant name='faz' */
@@ -369,7 +371,7 @@ In the example above, `FooAlias` will look like this:
369371

370372
```json
371373
{
372-
"faz": {
374+
"name#faz": {
373375
"prop": "hello world"
374376
}
375377
}
@@ -379,7 +381,7 @@ or:
379381

380382
```json
381383
{
382-
"bar": {
384+
"name#bar": {
383385
"prop": true
384386
}
385387
}

specification/_global/search/_types/suggester.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { Dictionary } from '@spec_utils/Dictionary'
3232
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
3333

3434
/**
35-
* @variants external
35+
* @variants typed_keys_quirk
3636
*/
3737
export type Suggest<TDocument> =
3838
| CompletionSuggest<TDocument>

specification/_types/aggregations/Aggregate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
3636
import { Void } from '@spec_utils/VoidValue'
3737

3838
/**
39-
* @variants external
39+
* @variants typed_keys_quirk
4040
* @non_exhaustive
4141
* @ext_doc_id search-aggregations
4242
*/

specification/ml/_types/inference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class LearningToRankConfig {
9191
}
9292

9393
/**
94-
* @variants external
94+
* @variants typed_keys_quirk
9595
*/
9696
export type FeatureExtractor = QueryFeatureExtractor
9797

specification/security/query_api_keys/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class ApiKeyAggregationContainer {
120120
}
121121

122122
/**
123-
* @variants external
123+
* @variants typed_keys_quirk
124124
* @non_exhaustive
125125
*/
126126
export type ApiKeyAggregate =

0 commit comments

Comments
 (0)