Skip to content

Commit 6c419d4

Browse files
committed
Keywords may not be used as prefixes
1 parent eeaa668 commit 6c419d4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/context.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,12 @@ api.createTermDefinition = ({
712712
'jsonld.SyntaxError',
713713
{code: 'invalid term definition', context: localCtx});
714714
}
715+
if(api.isKeyword(mapping['@id'])) {
716+
throw new JsonLdError(
717+
'Invalid JSON-LD syntax; keywords may not be used as prefixes',
718+
'jsonld.SyntaxError',
719+
{code: 'invalid term definition', context: localCtx});
720+
}
715721
if(typeof value['@prefix'] === 'boolean') {
716722
mapping._prefix = value['@prefix'] === true;
717723
} else {

tests/test-common.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ const TEST_TYPES = {
123123
/expand-manifest.jsonld#tso11$/,
124124
// @nest
125125
/expand-manifest.jsonld#tn008$/,
126-
// keywords
127-
/expand-manifest.jsonld#tpr33$/,
128126
// direction
129127
/expand-manifest.jsonld#tdi01$/,
130128
/expand-manifest.jsonld#tdi02$/,
@@ -359,8 +357,6 @@ const TEST_TYPES = {
359357
/toRdf-manifest.jsonld#tso11$/,
360358
// @next
361359
/toRdf-manifest.jsonld#tn008$/,
362-
// keywords
363-
/toRdf-manifest.jsonld#tpr33$/,
364360
// direction
365361
/toRdf-manifest.jsonld#tdi01$/,
366362
/toRdf-manifest.jsonld#tdi02$/,

0 commit comments

Comments
 (0)