Skip to content

Commit 7c939c4

Browse files
committed
Fix error on @id: @nest
1 parent db7d9a2 commit 7c939c4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/ContextParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ Tried mapping ${key} to ${JSON.stringify(keyValue)}`, ERROR_CODES.INVALID_KEYWOR
421421
switch (objectKey) {
422422
case '@id':
423423
if (Util.isValidKeyword(objectValue)
424-
&& objectValue !== '@type' && objectValue !== '@id' && objectValue !== '@graph') {
424+
&& objectValue !== '@type' && objectValue !== '@id' && objectValue !== '@graph' && objectValue !== '@nest') {
425425
throw new ErrorCoded(`Illegal keyword alias in term value, found: '${key}': '${JSON.stringify(value)}'`,
426426
ERROR_CODES.INVALID_IRI_MAPPING);
427427
}

test/ContextParser-test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,11 @@ Tried mapping @id to {}`, ERROR_CODES.KEYWORD_REDEFINITION));
10581058
.not.toThrow();
10591059
});
10601060

1061+
it('should not error on term with @id: @nest', async () => {
1062+
expect(() => parser.validate(<any> { term: { '@id': '@nest' } }, parseDefaults))
1063+
.not.toThrow();
1064+
});
1065+
10611066
it('should error on term with @type: array', async () => {
10621067
expect(() => parser.validate(<any> { term: { '@id': '@id', '@type': ['ex:a', 'ex:b'] } }, parseDefaults))
10631068
.toThrow(new ErrorCoded(`The value of an '@type' must be a string, got '"object"'`,

0 commit comments

Comments
 (0)