@@ -96,7 +96,8 @@ api.process = ({activeCtx, localCtx, options}) => {
96
96
'Unsupported JSON-LD version: ' + ctx [ '@version' ] ,
97
97
'jsonld.UnsupportedVersion' ,
98
98
{ code : 'invalid @version value' , context : ctx } ) ;
99
- } else if ( activeCtx . processingMode && activeCtx . processingMode . indexOf ( 'json-ld-1.1' ) !== 0 ) {
99
+ }
100
+ if ( activeCtx . processingMode && activeCtx . processingMode . indexOf ( 'json-ld-1.1' ) !== 0 ) {
100
101
throw new JsonLdError (
101
102
'@version: ' + ctx [ '@version' ] + ' not compatible with ' + activeCtx . processingMode ,
102
103
'jsonld.ProcessingModeConflict' ,
@@ -107,7 +108,7 @@ api.process = ({activeCtx, localCtx, options}) => {
107
108
defined [ '@version' ] = true ;
108
109
}
109
110
110
- // If not set explicitly, set processingMode to "json-ld-1.0"
111
+ // if not set explicitly, set processingMode to "json-ld-1.0"
111
112
rval . processingMode = rval . processingMode || activeCtx . processingMode || 'json-ld-1.0' ;
112
113
113
114
// handle @base
@@ -379,7 +380,7 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
379
380
}
380
381
381
382
if ( '@container' in value ) {
382
- // Normalize container to an array form
383
+ // normalize container to an array form
383
384
const container = _isString ( value [ '@container' ] ) ? [ value [ '@container' ] ] : ( value [ '@container' ] || [ ] ) ;
384
385
const validContainers = [ '@list' , '@set' , '@index' , '@language' ] ;
385
386
let isValid = true ;
@@ -393,14 +394,14 @@ api.createTermDefinition = (activeCtx, localCtx, term, defined) => {
393
394
// check container length
394
395
isValid &= container . length <= ( hasSet ? 2 : 1 ) ;
395
396
} else {
396
- // container must be a string which is one of the validContainers
397
+ // in JSON-LD 1.0, container must not be an array (it must be a string, which is one of the validContainers)
397
398
isValid &= ! _isArray ( value [ '@container' ] ) ;
398
399
399
400
// check container length
400
401
isValid &= container . length <= 1 ;
401
402
}
402
403
403
- // Check against valid containers
404
+ // check against valid containers
404
405
isValid &= container . every ( c => validContainers . includes ( c ) ) ;
405
406
406
407
// @set not allowed with @list
0 commit comments