Skip to content

Commit 172e6e4

Browse files
fix(ls): address final PR #5104 review comments
Remove redundant toValue() calls in allowedFields linter function where parentKey is already extracted. Rename test fixture to follow standard naming convention without -invalid suffix. Changes: - Optimize linter-functions.ts line 244 to use parentKey directly - Rename operation-reply-fields-types-3-0-invalid.yaml to match pattern - Update test reference in operation-reply.ts Fixes remaining issues from PR #5104 comments 37, 39, 43, 45, 46. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 615ae6b commit 172e6e4

File tree

4 files changed

+9
-36
lines changed

4 files changed

+9
-36
lines changed

packages/apidom-ls/src/services/validation/linter-functions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ export const standardLinterfunctions: FunctionItem[] = [
241241
const included = keys.includes(parentKey);
242242
const isExtension =
243243
allowExtensionPrefix !== undefined &&
244-
typeof toValue(parentKey) === 'string' &&
245-
toValue(parentKey as Element).startsWith(allowExtensionPrefix);
244+
typeof parentKey === 'string' &&
245+
parentKey.startsWith(allowExtensionPrefix);
246246
return !included && (allowExtensionPrefix === undefined || !isExtension);
247247
},
248248
{

packages/apidom-ls/test/fixtures/validation/asyncapi/operation-reply-fields-types-3-0-invalid.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.

packages/apidom-ls/test/fixtures/validation/asyncapi/operation-reply-fields-types-3-0.yaml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@ operations:
1111
channel:
1212
$ref: '#/channels/testChannel'
1313
reply:
14-
# Valid - address is an object
15-
address:
16-
location: $message.header#/replyTo
17-
# Valid - channel is a reference
18-
channel:
19-
$ref: '#/channels/testChannel'
20-
# Valid - messages is an array
21-
messages:
22-
- $ref: '#/components/messages/testMessage'
23-
components:
24-
messages:
25-
testMessage:
26-
payload:
27-
type: object
14+
# Invalid - address should be an Operation Reply Address Object or Reference, not a string
15+
address: invalid_string
16+
# Invalid - channel should be a Reference Object or Channel Object, not a number
17+
channel: 123
18+
# Invalid - messages should be an array, not a string
19+
messages: invalid_string

packages/apidom-ls/test/operation-reply.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const specOperationReplyFieldsTypesInvalid = fs
2323
'fixtures',
2424
'validation',
2525
'asyncapi',
26-
'operation-reply-fields-types-3-0-invalid.yaml',
26+
'operation-reply-fields-types-3-0.yaml',
2727
),
2828
)
2929
.toString();

0 commit comments

Comments
 (0)