@@ -27,6 +27,7 @@ import {
27
27
SchemaValidatorResult ,
28
28
SmartDefaultProvider ,
29
29
} from './interface' ;
30
+ import { JsonSchema } from './schema' ;
30
31
import { visitJson , visitJsonSchema } from './visitor' ;
31
32
32
33
// This interface should be exported from ajv, but they only export the class and not the type.
@@ -299,7 +300,7 @@ export class CoreSchemaRegistry implements SchemaRegistry {
299
300
* (using schema as a URI).
300
301
* @returns An Observable of the Validation function.
301
302
*/
302
- compile ( schema : JsonObject ) : Observable < SchemaValidator > {
303
+ compile ( schema : JsonSchema ) : Observable < SchemaValidator > {
303
304
const schemaInfo : SchemaInfo = {
304
305
smartDefaultRecord : new Map < string , JsonObject > ( ) ,
305
306
promptDefinitions : [ ] ,
@@ -346,6 +347,10 @@ export class CoreSchemaRegistry implements SchemaRegistry {
346
347
// tslint:disable-next-line:no-any https://github.com/ReactiveX/rxjs/issues/3989
347
348
result = ( result as any ) . pipe (
348
349
...[ ...this . _pre ] . map ( visitor => concatMap ( ( data : JsonValue ) => {
350
+ if ( schema === false || schema === true ) {
351
+ return of ( data ) ;
352
+ }
353
+
349
354
return visitJson ( data , visitor , schema , this . _resolver , validate ) ;
350
355
} ) ) ,
351
356
) ;
@@ -368,6 +373,9 @@ export class CoreSchemaRegistry implements SchemaRegistry {
368
373
369
374
return value ;
370
375
} ;
376
+ if ( schema === false || schema === true ) {
377
+ return of ( updatedData ) ;
378
+ }
371
379
372
380
return visitJson ( updatedData , visitor , schema , this . _resolver , validate ) ;
373
381
} ) ,
@@ -410,6 +418,10 @@ export class CoreSchemaRegistry implements SchemaRegistry {
410
418
// tslint:disable-next-line:no-any https://github.com/ReactiveX/rxjs/issues/3989
411
419
result = ( result as any ) . pipe (
412
420
...[ ...this . _post ] . map ( visitor => concatMap ( ( data : JsonValue ) => {
421
+ if ( schema === false || schema === true ) {
422
+ return of ( schema ) ;
423
+ }
424
+
413
425
return visitJson ( data , visitor , schema , this . _resolver , validate ) ;
414
426
} ) ) ,
415
427
) ;
0 commit comments