Skip to content

Commit fb3f70a

Browse files
authored
feat(ls): add docs rules for OpenAPI 2.0 Parameter Object (#3600)
Refs #3104
1 parent 2280e48 commit fb3f70a

File tree

2 files changed

+296
-7
lines changed

2 files changed

+296
-7
lines changed

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

+174-4
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const completion: ApidomCompletionItem[] = [
253253
documentation: {
254254
kind: 'markdown',
255255
value:
256-
'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.',
256+
'`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.',
257257
},
258258
targetSpecs: OpenAPI2,
259259
},
@@ -628,7 +628,7 @@ const completion: ApidomCompletionItem[] = [
628628
format: CompletionFormat.QUOTED,
629629
type: CompletionType.VALUE,
630630
insertTextFormat: 2,
631-
targetSpecs: OpenAPI3,
631+
targetSpecs: [...OpenAPI2, ...OpenAPI3],
632632
},
633633
{
634634
target: 'in',
@@ -638,7 +638,7 @@ const completion: ApidomCompletionItem[] = [
638638
format: CompletionFormat.QUOTED,
639639
type: CompletionType.VALUE,
640640
insertTextFormat: 2,
641-
targetSpecs: OpenAPI3,
641+
targetSpecs: [...OpenAPI2, ...OpenAPI3],
642642
},
643643
{
644644
target: 'in',
@@ -648,7 +648,27 @@ const completion: ApidomCompletionItem[] = [
648648
format: CompletionFormat.QUOTED,
649649
type: CompletionType.VALUE,
650650
insertTextFormat: 2,
651-
targetSpecs: OpenAPI3,
651+
targetSpecs: [...OpenAPI2, ...OpenAPI3],
652+
},
653+
{
654+
target: 'in',
655+
label: 'formData',
656+
insertText: 'formData',
657+
kind: 12,
658+
format: CompletionFormat.QUOTED,
659+
type: CompletionType.VALUE,
660+
insertTextFormat: 2,
661+
targetSpecs: OpenAPI2,
662+
},
663+
{
664+
target: 'in',
665+
label: 'body',
666+
insertText: 'body',
667+
kind: 12,
668+
format: CompletionFormat.QUOTED,
669+
type: CompletionType.VALUE,
670+
insertTextFormat: 2,
671+
targetSpecs: OpenAPI2,
652672
},
653673
{
654674
target: 'in',
@@ -660,6 +680,156 @@ const completion: ApidomCompletionItem[] = [
660680
insertTextFormat: 2,
661681
targetSpecs: OpenAPI3,
662682
},
683+
{
684+
target: 'type',
685+
label: 'string',
686+
insertText: 'string',
687+
kind: 12,
688+
format: CompletionFormat.QUOTED,
689+
type: CompletionType.VALUE,
690+
insertTextFormat: 2,
691+
targetSpecs: OpenAPI2,
692+
},
693+
{
694+
target: 'type',
695+
label: 'number',
696+
insertText: 'number',
697+
kind: 12,
698+
format: CompletionFormat.QUOTED,
699+
type: CompletionType.VALUE,
700+
insertTextFormat: 2,
701+
targetSpecs: OpenAPI2,
702+
},
703+
{
704+
target: 'type',
705+
label: 'integer',
706+
insertText: 'integer',
707+
kind: 12,
708+
format: CompletionFormat.QUOTED,
709+
type: CompletionType.VALUE,
710+
insertTextFormat: 2,
711+
targetSpecs: OpenAPI2,
712+
},
713+
{
714+
target: 'type',
715+
label: 'boolean',
716+
insertText: 'boolean',
717+
kind: 12,
718+
format: CompletionFormat.QUOTED,
719+
type: CompletionType.VALUE,
720+
insertTextFormat: 2,
721+
targetSpecs: OpenAPI2,
722+
},
723+
{
724+
target: 'type',
725+
label: 'array',
726+
insertText: 'array',
727+
kind: 12,
728+
format: CompletionFormat.QUOTED,
729+
type: CompletionType.VALUE,
730+
insertTextFormat: 2,
731+
targetSpecs: OpenAPI2,
732+
},
733+
{
734+
target: 'type',
735+
label: 'file',
736+
insertText: 'file',
737+
kind: 12,
738+
format: CompletionFormat.QUOTED,
739+
type: CompletionType.VALUE,
740+
insertTextFormat: 2,
741+
targetSpecs: OpenAPI2,
742+
},
743+
{
744+
target: 'format',
745+
label: 'int32',
746+
insertText: 'int32',
747+
kind: 12,
748+
format: CompletionFormat.QUOTED,
749+
type: CompletionType.VALUE,
750+
insertTextFormat: 2,
751+
targetSpecs: OpenAPI2,
752+
},
753+
{
754+
target: 'format',
755+
label: 'int64',
756+
insertText: 'int64',
757+
kind: 12,
758+
format: CompletionFormat.QUOTED,
759+
type: CompletionType.VALUE,
760+
insertTextFormat: 2,
761+
targetSpecs: OpenAPI2,
762+
},
763+
{
764+
target: 'format',
765+
label: 'float',
766+
insertText: 'float',
767+
kind: 12,
768+
format: CompletionFormat.QUOTED,
769+
type: CompletionType.VALUE,
770+
insertTextFormat: 2,
771+
targetSpecs: OpenAPI2,
772+
},
773+
{
774+
target: 'format',
775+
label: 'double',
776+
insertText: 'double',
777+
kind: 12,
778+
format: CompletionFormat.QUOTED,
779+
type: CompletionType.VALUE,
780+
insertTextFormat: 2,
781+
targetSpecs: OpenAPI2,
782+
},
783+
{
784+
target: 'format',
785+
label: 'byte',
786+
insertText: 'byte',
787+
kind: 12,
788+
format: CompletionFormat.QUOTED,
789+
type: CompletionType.VALUE,
790+
insertTextFormat: 2,
791+
targetSpecs: OpenAPI2,
792+
},
793+
{
794+
target: 'format',
795+
label: 'binary',
796+
insertText: 'binary',
797+
kind: 12,
798+
format: CompletionFormat.QUOTED,
799+
type: CompletionType.VALUE,
800+
insertTextFormat: 2,
801+
targetSpecs: OpenAPI2,
802+
},
803+
{
804+
target: 'format',
805+
label: 'date',
806+
insertText: 'date',
807+
kind: 12,
808+
format: CompletionFormat.QUOTED,
809+
type: CompletionType.VALUE,
810+
insertTextFormat: 2,
811+
targetSpecs: OpenAPI2,
812+
},
813+
{
814+
target: 'format',
815+
label: 'date-time',
816+
insertText: 'date-time',
817+
kind: 12,
818+
format: CompletionFormat.QUOTED,
819+
type: CompletionType.VALUE,
820+
insertTextFormat: 2,
821+
targetSpecs: OpenAPI2,
822+
},
823+
{
824+
target: 'format',
825+
label: 'password',
826+
insertText: 'password',
827+
kind: 12,
828+
format: CompletionFormat.QUOTED,
829+
type: CompletionType.VALUE,
830+
insertTextFormat: 2,
831+
targetSpecs: OpenAPI2,
832+
},
663833
{
664834
target: 'style',
665835
label: 'form',

0 commit comments

Comments
 (0)