Skip to content

Commit 5130e76

Browse files
committed
feat(ls): provide OpenAPI 3.0.x OAuth Flow completion rules
Refs #2032
1 parent 26a895d commit 5130e76

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import {
2+
ApidomCompletionItem,
3+
CompletionFormat,
4+
CompletionType,
5+
} from '../../../apidom-language-types';
6+
7+
const completion: ApidomCompletionItem[] = [
8+
{
9+
label: 'authorizationUrl',
10+
insertText: 'authorizationUrl',
11+
kind: 14,
12+
format: CompletionFormat.QUOTED,
13+
type: CompletionType.PROPERTY,
14+
insertTextFormat: 2,
15+
documentation: {
16+
kind: 'markdown',
17+
value:
18+
'**REQUIRED**. The authorization URL to be used for this flow. This MUST be in the form of a URL.',
19+
},
20+
targetSpecs: [
21+
{ namespace: 'openapi', version: '3.0.0' },
22+
{ namespace: 'openapi', version: '3.0.1' },
23+
{ namespace: 'openapi', version: '3.0.2' },
24+
{ namespace: 'openapi', version: '3.0.3' },
25+
],
26+
},
27+
{
28+
label: 'tokenUrl',
29+
insertText: 'tokenUrl',
30+
kind: 14,
31+
format: CompletionFormat.QUOTED,
32+
type: CompletionType.PROPERTY,
33+
insertTextFormat: 2,
34+
documentation: {
35+
kind: 'markdown',
36+
value:
37+
'**REQUIRED**. The token URL to be used for this flow. This MUST be in the form of a URL.',
38+
},
39+
targetSpecs: [
40+
{ namespace: 'openapi', version: '3.0.0' },
41+
{ namespace: 'openapi', version: '3.0.1' },
42+
{ namespace: 'openapi', version: '3.0.2' },
43+
{ namespace: 'openapi', version: '3.0.3' },
44+
],
45+
},
46+
{
47+
label: 'refreshUrl',
48+
insertText: 'refreshUrl ',
49+
kind: 14,
50+
format: CompletionFormat.QUOTED,
51+
type: CompletionType.PROPERTY,
52+
insertTextFormat: 2,
53+
documentation: {
54+
kind: 'markdown',
55+
value: 'The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.',
56+
},
57+
targetSpecs: [
58+
{ namespace: 'openapi', version: '3.0.0' },
59+
{ namespace: 'openapi', version: '3.0.1' },
60+
{ namespace: 'openapi', version: '3.0.2' },
61+
{ namespace: 'openapi', version: '3.0.3' },
62+
],
63+
},
64+
{
65+
label: 'scopes',
66+
insertText: 'scopes ',
67+
kind: 14,
68+
format: CompletionFormat.OBJECT,
69+
type: CompletionType.PROPERTY,
70+
insertTextFormat: 2,
71+
documentation: {
72+
kind: 'markdown',
73+
value:
74+
'**REQUIRED**. The available scopes for the OAuth2 security scheme. A map between the scope name and a short description for it. The map MAY be empty.',
75+
},
76+
},
77+
];
78+
79+
export default completion;

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