From 92088183c3f40652afea3d083c1d2c5a6db5028b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Wed, 10 May 2023 14:20:05 +0200 Subject: [PATCH] feat(json-schema-2020-12): add support for contentEncoding keyword (#8644) Refs #8513 --- .../components/keywords/Constraint/Constraint.jsx | 9 +++++---- src/core/plugins/json-schema-2020-12/fn.js | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx index 2c9c5fde9f9..dab082f7378 100644 --- a/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx +++ b/src/core/plugins/json-schema-2020-12/components/keywords/Constraint/Constraint.jsx @@ -10,10 +10,11 @@ import classNames from "classnames" * from JSON Schema 2020-12 validation vocabulary. */ const Constraint = ({ constraint }) => { - const isPattern = /^matches /.test(constraint) - const isStringRange = /characters$/.test(constraint) - const isContentMediaType = /^media type: / - const isStringRelated = isPattern || isStringRange || isContentMediaType + const isStringRelated = + /^matches /.test(constraint) || // pattern keyword + /characters$/.test(constraint) || // minLength, maxLength keywords + /^media type: /.test(constraint) || // contentMediaType keyword + /^encoding: /.test(constraint) // contentEncoding keyword return ( { if (schema?.contentMediaType) { constraints.push(`media type: ${schema.contentMediaType}`) } + if (schema?.contentEncoding) { + constraints.push(`encoding: ${schema.contentEncoding}`) + } return constraints }