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 21
21
- Better frame validation.
22
22
- Wildcard matching on ` @id ` and other ` requireAll ` semantics.
23
23
- Default frame for lists.
24
+ - Check unused scoped contexts for validity.
24
25
25
26
### Changed
26
27
- 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 ({
353
353
options,
354
354
overrideProtected
355
355
} ) ;
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
+ }
356
377
}
357
378
358
379
// cache processed result
Original file line number Diff line number Diff line change @@ -85,9 +85,6 @@ const TEST_TYPES = {
85
85
/ 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 $ / ,
86
86
// remote
87
87
/ 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 $ / ,
91
88
]
92
89
} ,
93
90
fn : 'expand' ,
@@ -206,9 +203,6 @@ const TEST_TYPES = {
206
203
// direction (compound-literal)
207
204
/ t o R d f - m a n i f e s t .j s o n l d # t d i 1 1 $ / ,
208
205
/ 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 $ / ,
212
206
]
213
207
} ,
214
208
fn : 'toRDF' ,
You can’t perform that action at this time.
0 commit comments