Skip to content

Commit f6a972f

Browse files
committed
feat(ls): provide OpenAPI 3.0.x Discriminator completion rules
Refs #2032
1 parent fb7fd19 commit f6a972f

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {
2+
ApidomCompletionItem,
3+
CompletionFormat,
4+
CompletionType,
5+
} from '../../../apidom-language-types';
6+
7+
const completion: ApidomCompletionItem[] = [
8+
{
9+
label: 'propertyName',
10+
insertText: 'propertyName',
11+
kind: 14,
12+
format: CompletionFormat.QUOTED,
13+
type: CompletionType.PROPERTY,
14+
insertTextFormat: 2,
15+
documentation: {
16+
kind: 'markdown',
17+
value:
18+
'**REQUIRED**. The name of the property in the payload that will hold the discriminator value.',
19+
},
20+
},
21+
{
22+
label: 'mapping',
23+
insertText: 'mapping',
24+
kind: 14,
25+
format: CompletionFormat.OBJECT,
26+
type: CompletionType.PROPERTY,
27+
insertTextFormat: 2,
28+
documentation: {
29+
kind: 'markdown',
30+
value:
31+
'Map[string, string]\n\\\n\\\nAn object to hold mappings between payload values and schema names or references.',
32+
},
33+
},
34+
];
35+
36+
export default completion;

packages/apidom-ls/src/config/openapi/discriminator/meta.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import completion from './completion';
12
import documentation from './documentation';
23
import { FormatMeta } from '../../../apidom-language-types';
34

45
const meta: FormatMeta = {
6+
completion,
57
documentation,
68
};
79

0 commit comments

Comments
 (0)