Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/model/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ export function parseVariantsTag (jsDoc: JSDoc[]): model.Variants | undefined {
const nonExhaustive = (typeof tags.non_exhaustive === 'string') ? true : undefined

const [type, ...values] = tags.variants.split(' ')
if (type === 'external') {
if (type === 'typed_keys_quirk') {
return {
kind: 'external_tag',
nonExhaustive
Expand Down
12 changes: 7 additions & 5 deletions docs/modeling-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ type FooOrBar = Foo | Bar

An example of internal variants are the type mapping properties.

#### External
#### typed_keys_quirk

**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.**

The key that defines the variant is external to the definition, like in the
case of aggregations in responses or suggesters.
Expand All @@ -343,15 +345,15 @@ name in the definition itself.
The syntax is:

```ts
/** @variants external */
/** @variants typed_keys_quirk */

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

For example:

```ts
/** @variants external */
/** @variants typed_keys_quirk */
type FooAlias = Faz | Bar

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

```json
{
"faz": {
"name#faz": {
"prop": "hello world"
}
}
Expand All @@ -379,7 +381,7 @@ or:

```json
{
"bar": {
"name#bar": {
"prop": true
}
}
Expand Down
2 changes: 1 addition & 1 deletion specification/_global/search/_types/suggester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Dictionary } from '@spec_utils/Dictionary'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'

/**
* @variants external
* @variants typed_keys_quirk
*/
export type Suggest<TDocument> =
| CompletionSuggest<TDocument>
Expand Down
2 changes: 1 addition & 1 deletion specification/_types/aggregations/Aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { Void } from '@spec_utils/VoidValue'

/**
* @variants external
* @variants typed_keys_quirk
* @non_exhaustive
* @ext_doc_id search-aggregations
*/
Expand Down
2 changes: 1 addition & 1 deletion specification/ml/_types/inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class LearningToRankConfig {
}

/**
* @variants external
* @variants typed_keys_quirk
*/
export type FeatureExtractor = QueryFeatureExtractor

Expand Down
2 changes: 1 addition & 1 deletion specification/security/query_api_keys/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class ApiKeyAggregationContainer {
}

/**
* @variants external
* @variants typed_keys_quirk
* @non_exhaustive
*/
export type ApiKeyAggregate =
Expand Down