Skip to content

Commit e6165e4

Browse files
msivasubramaniaandatho7561
authored andcommitted
checked const value for the boolean type
1 parent 1be76fb commit e6165e4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/languageservice/parser/jsonParser07.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ function validate(
908908

909909
if (isDefined(schema.const)) {
910910
const val = getNodeValue(node);
911-
if (!equals(val, schema.const) && !isAutoCompleteEqualMaybe(callFromAutoComplete, node, val, schema.const)) {
911+
if (!equals(val, schema.const, node.type) && !isAutoCompleteEqualMaybe(callFromAutoComplete, node, val, schema.const)) {
912912
validationResult.problems.push({
913913
location: { offset: node.offset, length: node.length },
914914
severity: DiagnosticSeverity.Warning,

src/languageservice/utils/objects.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
7-
export function equals(one: any, other: any): boolean {
7+
export function equals(one: any, other: any, type?: any): boolean {
8+
if (type === 'boolean') {
9+
one = JSON.parse(one);
10+
}
811
if (one === other) {
912
return true;
1013
}

0 commit comments

Comments
 (0)