Skip to content

Commit

Permalink
feat(ls): add docs rules for OpenAPI 2.0 Parameter Object (#3600)
Browse files Browse the repository at this point in the history
Refs #3104
  • Loading branch information
char0n authored Jan 2, 2024
1 parent 2280e48 commit fb3f70a
Show file tree
Hide file tree
Showing 2 changed files with 296 additions and 7 deletions.
178 changes: 174 additions & 4 deletions packages/apidom-ls/src/config/openapi/parameter/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Declares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterType) for this parameter.',
'`Any`\n\\\n\\\nDeclares the value of the parameter that the server will use if none is provided, for example a "count" to control the number of results per page might default to 100 if not supplied by the client in the request. (Note: "default" has no meaning for required parameters.) See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. Unlike JSON Schema this value MUST conform to the defined [`type`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#parameterType) for this parameter.',
},
targetSpecs: OpenAPI2,
},
Expand Down Expand Up @@ -628,7 +628,7 @@ const completion: ApidomCompletionItem[] = [
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI3,
targetSpecs: [...OpenAPI2, ...OpenAPI3],
},
{
target: 'in',
Expand All @@ -638,7 +638,7 @@ const completion: ApidomCompletionItem[] = [
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI3,
targetSpecs: [...OpenAPI2, ...OpenAPI3],
},
{
target: 'in',
Expand All @@ -648,7 +648,27 @@ const completion: ApidomCompletionItem[] = [
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI3,
targetSpecs: [...OpenAPI2, ...OpenAPI3],
},
{
target: 'in',
label: 'formData',
insertText: 'formData',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'in',
label: 'body',
insertText: 'body',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'in',
Expand All @@ -660,6 +680,156 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
targetSpecs: OpenAPI3,
},
{
target: 'type',
label: 'string',
insertText: 'string',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'type',
label: 'number',
insertText: 'number',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'type',
label: 'integer',
insertText: 'integer',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'type',
label: 'boolean',
insertText: 'boolean',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'type',
label: 'array',
insertText: 'array',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'type',
label: 'file',
insertText: 'file',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'int32',
insertText: 'int32',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'int64',
insertText: 'int64',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'float',
insertText: 'float',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'double',
insertText: 'double',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'byte',
insertText: 'byte',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'binary',
insertText: 'binary',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'date',
insertText: 'date',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'date-time',
insertText: 'date-time',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'format',
label: 'password',
insertText: 'password',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
targetSpecs: OpenAPI2,
},
{
target: 'style',
label: 'form',
Expand Down
Loading

0 comments on commit fb3f70a

Please sign in to comment.