Skip to content

Commit fca7cdf

Browse files
committed
feat(ls): provide OpenAPI 3.0.x License completion rules
Refs #2032
1 parent 89b80cd commit fca7cdf

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import {
2+
ApidomCompletionItem,
3+
CompletionFormat,
4+
CompletionType,
5+
} from '../../../apidom-language-types';
6+
7+
const completion: ApidomCompletionItem[] = [
8+
{
9+
label: 'name',
10+
insertText: 'name',
11+
kind: 14,
12+
format: CompletionFormat.QUOTED,
13+
type: CompletionType.PROPERTY,
14+
insertTextFormat: 2,
15+
documentation: {
16+
kind: 'markdown',
17+
value: '**REQUIRED**. The license name used for the API.',
18+
},
19+
},
20+
{
21+
label: 'identifier',
22+
insertText: 'identifier',
23+
kind: 14,
24+
format: CompletionFormat.QUOTED,
25+
type: CompletionType.PROPERTY,
26+
insertTextFormat: 2,
27+
documentation: {
28+
kind: 'markdown',
29+
value:
30+
'An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field.',
31+
},
32+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
33+
},
34+
{
35+
label: 'url',
36+
insertText: 'url',
37+
kind: 14,
38+
format: CompletionFormat.QUOTED,
39+
type: CompletionType.PROPERTY,
40+
insertTextFormat: 2,
41+
documentation: {
42+
kind: 'markdown',
43+
value: 'A URL to the license used for the API. MUST be in the format of a URL.',
44+
},
45+
targetSpecs: [
46+
{ namespace: 'openapi', version: '3.0.0' },
47+
{ namespace: 'openapi', version: '3.0.1' },
48+
{ namespace: 'openapi', version: '3.0.2' },
49+
{ namespace: 'openapi', version: '3.0.3' },
50+
],
51+
},
52+
{
53+
label: 'url',
54+
insertText: 'url',
55+
kind: 14,
56+
format: CompletionFormat.QUOTED,
57+
type: CompletionType.PROPERTY,
58+
insertTextFormat: 2,
59+
documentation: {
60+
kind: 'markdown',
61+
value:
62+
'A URL to the license used for the API. This MUST be in the form of a URL. The `url` field is mutually exclusive of the `identifier` field.',
63+
},
64+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
65+
},
66+
{
67+
label: 'email',
68+
insertText: 'email',
69+
kind: 14,
70+
format: CompletionFormat.QUOTED,
71+
type: CompletionType.PROPERTY,
72+
insertTextFormat: 2,
73+
documentation: {
74+
kind: 'markdown',
75+
value:
76+
'The email address of the contact person/organization. This MUST be in the form of an email address.',
77+
},
78+
},
79+
];
80+
81+
export default completion;

packages/apidom-ls/src/config/openapi/license/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)