File tree Expand file tree Collapse file tree 3 files changed +40
-136
lines changed Expand file tree Collapse file tree 3 files changed +40
-136
lines changed Original file line number Diff line number Diff line change @@ -470,29 +470,12 @@ const expanded = await jsonld.expand(data, {
470
470
});
471
471
```
472
472
473
- #### Strict Validation
474
-
475
- Some data may be valid and "safe" but still have issues that could indicate
476
- data problems. A "strict" validation mode is available that handles more issues
477
- that the "safe" validation mode. This mode may cause false positives so may be
478
- best suited for JSON-LD authoring tools.
479
-
480
- ``` js
481
- // expand a document in strict mode
482
- const expanded = await jsonld .expand (data, {
483
- eventHandler: jsonld .strictEventHandler
484
- });
485
- ```
486
-
487
473
#### Available Handlers
488
474
489
475
Some predefined event handlers are available to use alone or as part of a more
490
476
complex handler:
491
477
492
478
- ** safeEventHandler** : The handler used when ` safe ` is ` true ` .
493
- - ** strictEventHandler** : A handler that is more strict than the ` safe `
494
- handler and also fails on other detectable events related to possible input
495
- issues.
496
479
- ** logEventHandler** : A debugging handler that outputs to the console.
497
480
- ** logWarningHandler** : A debugging handler that outputs ` warning ` level
498
481
events to the console.
Original file line number Diff line number Diff line change @@ -126,23 +126,6 @@ api.safeEventHandler = function safeEventHandler({event, next}) {
126
126
next ( ) ;
127
127
} ;
128
128
129
- const _notStrictEventCodes = new Set ( [
130
- ..._notSafeEventCodes ,
131
- ] ) ;
132
-
133
- // strict handler that rejects all warning conditions
134
- api . strictEventHandler = function strictEventHandler ( { event, next} ) {
135
- // fail on all warnings
136
- if ( event . level === 'warning' && _notStrictEventCodes . has ( event . code ) ) {
137
- throw new JsonLdError (
138
- 'Strict mode validation error.' ,
139
- 'jsonld.ValidationError' ,
140
- { event}
141
- ) ;
142
- }
143
- next ( ) ;
144
- } ;
145
-
146
129
// logs all events and continues
147
130
api . logEventHandler = function logEventHandler ( { event, next} ) {
148
131
console . log ( `EVENT: ${ event . message } ` , { event} ) ;
You can’t perform that action at this time.
0 commit comments