-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ls): add path template linting rule (#3538)
This linting rule that validates if the template expressions defined within the path template are all present in the appropriate Parameter Objects. Refs #3517 Co-authored-by: Vladimír Gorej <vladimir.gorej@gmail.com>
- Loading branch information
1 parent
5c61dba
commit 0055a09
Showing
7 changed files
with
549 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined-2-0.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
swagger: '2.0' | ||
info: | ||
title: Foo | ||
version: 0.1.0 | ||
parameters: | ||
test_id: | ||
name: test_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Test Id | ||
paths: | ||
/foo/bar/{baz}/test/{foo_id}/baz/{bar_id}: | ||
delete: | ||
summary: Delete foo bar test baz | ||
operationId: deleteFooBarTestBaz | ||
parameters: | ||
- name: foo_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Foo Id | ||
- name: bar_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Bar Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/test/{foo_id}/{bar_id}: | ||
get: | ||
summary: Get test foo bar | ||
operationId: getTestFooBar | ||
parameters: | ||
- name: foo_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Foo Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/reference/{test_id}/{baz_id}: | ||
get: | ||
summary: Get test baz | ||
operationId: getReferenceTestBaz | ||
parameters: | ||
- $ref: '#/parameters/test_id' | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/just_parameters_object/{x_id}/{y_id}: | ||
parameters: | ||
- name: x_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: X Id | ||
/both_parameters_and_operations_object/{a_id}/{b_id}/{c_id}: | ||
get: | ||
summary: Get both parameters and operations object a b c | ||
operationId: getBothParametersAndOperationsObjectABC | ||
parameters: | ||
- name: b_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: B Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
parameters: | ||
- name: a_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: A Id |
105 changes: 105 additions & 0 deletions
105
packages/apidom-ls/test/fixtures/validation/oas/path-template-all-defined-3-0.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Foo | ||
version: 0.1.0 | ||
components: | ||
parameters: | ||
test_id: | ||
name: test_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Test Id | ||
paths: | ||
/foo/bar/{baz}/test/{foo_id}/baz/{bar_id}: | ||
delete: | ||
summary: Delete foo bar test baz | ||
operationId: deleteFooBarTestBaz | ||
parameters: | ||
- name: foo_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Foo Id | ||
- name: bar_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Bar Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/test/{foo_id}/{bar_id}: | ||
get: | ||
summary: Get test foo bar | ||
operationId: getTestFooBar | ||
parameters: | ||
- name: foo_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: Foo Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/reference/{test_id}/{baz_id}: | ||
get: | ||
summary: Get test baz | ||
operationId: getReferenceTestBaz | ||
parameters: | ||
- $ref: '#/components/parameters/test_id' | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
/just_parameters_object/{x_id}/{y_id}: | ||
parameters: | ||
- name: x_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: X Id | ||
/both_parameters_and_operations_object/{a_id}/{b_id}/{c_id}: | ||
get: | ||
summary: Get both parameters and operations object a b c | ||
operationId: getBothParametersAndOperationsObjectABC | ||
parameters: | ||
- name: b_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: B Id | ||
responses: | ||
'200': | ||
description: Successful Response | ||
content: | ||
application/json: | ||
schema: {} | ||
parameters: | ||
- name: a_id | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
format: uuid | ||
title: A Id |
Oops, something went wrong.