Skip to content

Commit a4618af

Browse files
authored
feat(ls): provide OpenAPI 3.1.0 completion rules for Encoding object (#2169)
1 parent de53a13 commit a4618af

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

packages/apidom-ls/src/config/openapi/encoding/completion.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ const completion: ApidomCompletionItem[] = [
2424
{ namespace: 'openapi', version: '3.0.3' },
2525
],
2626
},
27+
{
28+
label: 'contentType',
29+
insertText: 'contentType',
30+
kind: 14,
31+
format: CompletionFormat.QUOTED,
32+
type: CompletionType.PROPERTY,
33+
insertTextFormat: 2,
34+
documentation: {
35+
kind: 'markdown',
36+
value:
37+
'The Content-Type for encoding a specific property. Default value depends on the property type: for `object` - `application/json`; for `array` – the default is defined based on the inner type; for all other cases the default is `application/octet-stream`. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types.',
38+
},
39+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
40+
},
2741
{
2842
label: 'headers',
2943
insertText: 'headers',
@@ -43,6 +57,20 @@ const completion: ApidomCompletionItem[] = [
4357
{ namespace: 'openapi', version: '3.0.3' },
4458
],
4559
},
60+
{
61+
label: 'headers',
62+
insertText: 'headers',
63+
kind: 14,
64+
format: CompletionFormat.OBJECT,
65+
type: CompletionType.PROPERTY,
66+
insertTextFormat: 2,
67+
documentation: {
68+
kind: 'markdown',
69+
value:
70+
'Map[`string`, [Header Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#headerObject) \\| [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\\\n\\\nA map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`.',
71+
},
72+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
73+
},
4674
{
4775
label: 'style',
4876
insertText: 'style',
@@ -62,6 +90,20 @@ const completion: ApidomCompletionItem[] = [
6290
{ namespace: 'openapi', version: '3.0.3' },
6391
],
6492
},
93+
{
94+
label: 'style',
95+
insertText: 'style',
96+
kind: 14,
97+
format: CompletionFormat.QUOTED,
98+
type: CompletionType.PROPERTY,
99+
insertTextFormat: 2,
100+
documentation: {
101+
kind: 'markdown',
102+
value:
103+
'Describes how a specific property value will be serialized depending on its type. See [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterObject) for details on the [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType) (implicit or explicit) SHALL be ignored.',
104+
},
105+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
106+
},
65107
{
66108
label: 'explode',
67109
insertText: 'explode',
@@ -81,6 +123,20 @@ const completion: ApidomCompletionItem[] = [
81123
{ namespace: 'openapi', version: '3.0.3' },
82124
],
83125
},
126+
{
127+
label: 'explode',
128+
insertText: 'explode',
129+
kind: 14,
130+
format: CompletionFormat.UNQUOTED,
131+
type: CompletionType.PROPERTY,
132+
insertTextFormat: 2,
133+
documentation: {
134+
kind: 'markdown',
135+
value:
136+
'When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded` or `multipart/form-data`. If a value is explicitly defined, then the value of [`contentType`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encodingContentType) (implicit or explicit) SHALL be ignored.',
137+
},
138+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
139+
},
84140
{
85141
label: 'allowReserved',
86142
insertText: 'allowReserved',
@@ -100,6 +156,20 @@ const completion: ApidomCompletionItem[] = [
100156
{ namespace: 'openapi', version: '3.0.3' },
101157
],
102158
},
159+
{
160+
label: 'allowReserved',
161+
insertText: 'allowReserved',
162+
kind: 14,
163+
format: CompletionFormat.UNQUOTED,
164+
type: CompletionType.PROPERTY,
165+
insertTextFormat: 2,
166+
documentation: {
167+
kind: 'markdown',
168+
value:
169+
"Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986](https://tools.ietf.org/html/rfc3986#section-2.2) `:/?#[]@!$&'()*+,;=` to be included without percent-encoding. The default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`.",
170+
},
171+
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }],
172+
},
103173
];
104174

105175
export default completion;

0 commit comments

Comments
 (0)