This repository was archived by the owner on Nov 8, 2024. It is now read-only.
File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable no-console */
2
+
3
+ /**
4
+ * Outputs a deprecation message.
5
+ * Supports silencing the messages based on the environmental variable.
6
+ * @param {string } message
7
+ */
8
+ module . exports = function warnOnDeprecation ( message ) {
9
+ const shouldOutputMessage =
10
+ typeof process === 'undefined' ||
11
+ ! process . env . SUPPRESS_DEPRECATION_WARNINGS ;
12
+
13
+ if ( shouldOutputMessage ) {
14
+ console . warn ( `DEPRECATED: ${ message } ` ) ;
15
+ }
16
+ } ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const jsonPointer = require('json-pointer');
5
5
const { JsonSchemaValidator, META_SCHEMA } = require ( './json-schema-next' ) ;
6
6
const { ValidationErrors } = require ( './validation-errors' ) ;
7
7
const toGavelResult = require ( '../utils/to-gavel-result' ) ;
8
+ const warnOnDeprecation = require ( '../utils/warn-on-deprecation' ) ;
8
9
9
10
/**
10
11
* Returns a proper article for a given string.
@@ -76,6 +77,10 @@ class JsonSchemaLegacy extends JsonSchemaValidator {
76
77
77
78
switch ( this . jsonSchemaVersion ) {
78
79
case 'draftV3' :
80
+ warnOnDeprecation (
81
+ 'JSON Schema Draft V3 is deprecated. Please use a newer version of JSON Schema (Draft V4-7).'
82
+ ) ;
83
+
79
84
return this . validateUsingAmanda ( parsedData ) ;
80
85
case 'draftV4' :
81
86
return this . validateUsingTV4 ( parsedData ) ;
You can’t perform that action at this time.
0 commit comments