-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(apidom-ls): lint parameter defined in path template #3571
Conversation
b23fae4
to
44242ea
Compare
44242ea
to
8c5af8c
Compare
8bfbe03
to
6e47f3f
Compare
6e47f3f
to
edfb653
Compare
All right, so our first order of business if to determine if the Path Item Object parametersWe're specifically talking about 1. Determining Path Item relationshipWe first need to determine if Predicate will look like this: const isInPathItemElement = isArrayElement(paramerElement.parent) && includesClasses(['path-item-parameters'], parameterElement.parent)
const pathItemElement = parameterElement.parent.parent.parent Tip We can avoid step 1. and all the following steps by immediately looking into 2. Determining if Path Item is part of path templatingTo determine if the found Predicate will look like this: const isPathItemPartOfPathTemplating = isStringElement(pathItemElement.meta.get('path');
const pathTemplate = toValue(pathItemElement.meta.get('path')); 3. Determining if Parameter Object is matched with path templatingThis is a bit tricky. We'll have to use openapi-path-templating to parse the path template into the AST: This path template
If the Only after we have the above implementation, it makes sense to focus on |
13f39aa
to
8918ce1
Compare
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
|
ccf0fcf
to
0b25dd6
Compare
0b25dd6
to
31fc3b3
Compare
All right, so as discussed we'll handle the |
packages/apidom-ls/src/config/openapi/parameter/lint/is-defined-within-path-template.ts
Outdated
Show resolved
Hide resolved
packages/apidom-ls/src/config/openapi/parameter/lint/is-defined-within-path-template.ts
Outdated
Show resolved
Hide resolved
bb0c8f2
to
4d2dc74
Compare
@char0n Thanks for the suggestions. I implemented all of them and I also updated fixtures to include all the possible places where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good here. Nice job!
Refs #3546