Skip to content

Commit 2d50d89

Browse files
gkelloggdavidlehn
authored andcommitted
Keywords may not be used as prefixes
1 parent 24110c0 commit 2d50d89

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/context.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,12 @@ api.createTermDefinition = ({
770770
'jsonld.SyntaxError',
771771
{code: 'invalid term definition', context: localCtx});
772772
}
773+
if(api.isKeyword(mapping['@id'])) {
774+
throw new JsonLdError(
775+
'Invalid JSON-LD syntax; keywords may not be used as prefixes',
776+
'jsonld.SyntaxError',
777+
{code: 'invalid term definition', context: localCtx});
778+
}
773779
if(typeof value['@prefix'] === 'boolean') {
774780
mapping._prefix = value['@prefix'] === true;
775781
} else {

0 commit comments

Comments
 (0)