File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -30,14 +30,14 @@ const bsonDocuments = [{
30
30
describe . only ( 'Documents -> Generate schema -> Validate Documents against the schema' , function ( ) {
31
31
it ( 'Standard JSON Schema with Relaxed EJSON' , async function ( ) {
32
32
const ajv = new Ajv2020 ( ) ;
33
- // First we get the schema
33
+ // First we get the JSON schema from BSON
34
34
const analyzedDocuments = await analyzeDocuments ( bsonDocuments ) ;
35
35
const schema = await analyzedDocuments . getStandardJsonSchema ( ) ;
36
36
const validate = ajv . compile ( schema ) ;
37
37
for ( const doc of bsonDocuments ) {
38
- // Then we get EJSON documents
38
+ // Then we get EJSON
39
39
const relaxedEJSONDoc = EJSON . serialize ( doc , { relaxed : true } ) ;
40
- // Which we validate against the schema
40
+ // And validate it agains the JSON Schema
41
41
const valid = validate ( relaxedEJSONDoc ) ;
42
42
if ( validate . errors ) console . error ( 'Validation failed' , validate . errors ) ;
43
43
assert . strictEqual ( valid , true ) ;
You can’t perform that action at this time.
0 commit comments