feat(json-schema-2020-12): add support for contentMediaType keyword (#8640)

Refs #8513
This commit is contained in:
Vladimír Gorej
2023-05-10 14:01:52 +02:00
committed by GitHub
parent 5f6423c8be
commit c15e69eb4f
2 changed files with 8 additions and 2 deletions

View File

@@ -11,8 +11,9 @@ import classNames from "classnames"
*/ */
const Constraint = ({ constraint }) => { const Constraint = ({ constraint }) => {
const isPattern = /^matches /.test(constraint) const isPattern = /^matches /.test(constraint)
const isStringRange = /characters/.test(constraint) const isStringRange = /characters$/.test(constraint)
const isStringRelated = isPattern || isStringRange const isContentMediaType = /^media type: /
const isStringRelated = isPattern || isStringRange || isContentMediaType
return ( return (
<span <span

View File

@@ -292,6 +292,11 @@ export const stringifyConstraints = (schema) => {
) )
if (objectRange !== null) constraints.push(objectRange) if (objectRange !== null) constraints.push(objectRange)
// a Vocabulary for the Contents of String-Encoded Data
if (schema?.contentMediaType) {
constraints.push(`media type: ${schema.contentMediaType}`)
}
return constraints return constraints
} }