feat(json-schema-2020-12): add support for contentEncoding keyword (#8644)
Refs #8513
This commit is contained in:
@@ -10,10 +10,11 @@ import classNames from "classnames"
|
|||||||
* from JSON Schema 2020-12 validation vocabulary.
|
* from JSON Schema 2020-12 validation vocabulary.
|
||||||
*/
|
*/
|
||||||
const Constraint = ({ constraint }) => {
|
const Constraint = ({ constraint }) => {
|
||||||
const isPattern = /^matches /.test(constraint)
|
const isStringRelated =
|
||||||
const isStringRange = /characters$/.test(constraint)
|
/^matches /.test(constraint) || // pattern keyword
|
||||||
const isContentMediaType = /^media type: /
|
/characters$/.test(constraint) || // minLength, maxLength keywords
|
||||||
const isStringRelated = isPattern || isStringRange || isContentMediaType
|
/^media type: /.test(constraint) || // contentMediaType keyword
|
||||||
|
/^encoding: /.test(constraint) // contentEncoding keyword
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -296,6 +296,9 @@ export const stringifyConstraints = (schema) => {
|
|||||||
if (schema?.contentMediaType) {
|
if (schema?.contentMediaType) {
|
||||||
constraints.push(`media type: ${schema.contentMediaType}`)
|
constraints.push(`media type: ${schema.contentMediaType}`)
|
||||||
}
|
}
|
||||||
|
if (schema?.contentEncoding) {
|
||||||
|
constraints.push(`encoding: ${schema.contentEncoding}`)
|
||||||
|
}
|
||||||
|
|
||||||
return constraints
|
return constraints
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user