File tree Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Expand file tree Collapse file tree 3 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 2121- Better frame validation.
2222- Wildcard matching on ` @id ` and other ` requireAll ` semantics.
2323- Default frame for lists.
24+ - Check unused scoped contexts for validity.
2425
2526### Changed
2627- Keep term definitions mapping to null so they may be protected.
Original file line number Diff line number Diff line change @@ -353,6 +353,27 @@ api.process = async ({
353353 options,
354354 overrideProtected
355355 } ) ;
356+
357+ if ( _isObject ( ctx [ key ] ) && '@context' in ctx [ key ] ) {
358+ // parse context to validate
359+ try {
360+ await api . process ( {
361+ activeCtx : rval ,
362+ localCtx : ctx [ key ] [ '@context' ] ,
363+ overrideProtected : true ,
364+ options
365+ } ) ;
366+ } catch ( e ) {
367+ throw new JsonLdError (
368+ 'Invalid JSON-LD syntax; invalid scoped context.' ,
369+ 'jsonld.SyntaxError' ,
370+ {
371+ code : 'invalid scoped context' ,
372+ context : ctx [ key ] [ '@context' ] ,
373+ term : key
374+ } ) ;
375+ }
376+ }
356377 }
357378
358379 // cache processed result
Original file line number Diff line number Diff line change @@ -85,9 +85,6 @@ const TEST_TYPES = {
8585 / e x p a n d - m a n i f e s t .j s o n l d # t h c 0 5 $ / ,
8686 // remote
8787 / r e m o t e - d o c - m a n i f e s t .j s o n l d # t 0 0 1 3 $ / , // HTML
88- // unused scoped context
89- / e x p a n d - m a n i f e s t .j s o n l d # t c 0 3 2 $ / ,
90- / e x p a n d - m a n i f e s t .j s o n l d # t c 0 3 3 $ / ,
9188 ]
9289 } ,
9390 fn : 'expand' ,
@@ -206,9 +203,6 @@ const TEST_TYPES = {
206203 // direction (compound-literal)
207204 / t o R d f - m a n i f e s t .j s o n l d # t d i 1 1 $ / ,
208205 / t o R d f - m a n i f e s t .j s o n l d # t d i 1 2 $ / ,
209- // unused scoped context
210- / t o R d f - m a n i f e s t .j s o n l d # t c 0 3 2 $ / ,
211- / t o R d f - m a n i f e s t .j s o n l d # t c 0 3 3 $ / ,
212206 ]
213207 } ,
214208 fn : 'toRDF' ,
You can’t perform that action at this time.
0 commit comments