-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: v5 compatibility mode when draft-06 meta schema is absent
- Loading branch information
1 parent
a6ea946
commit 1567814
Showing
5 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
metaSchemaRef: metaSchemaRef | ||
}; | ||
|
||
var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; | ||
|
||
function metaSchemaRef(ajv) { | ||
var defaultMeta = ajv._opts.defaultMeta; | ||
if (typeof defaultMeta == 'string') return { $ref: defaultMeta }; | ||
if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID }; | ||
console.warn('meta schema not defined'); | ||
return {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters