feat(json-schema-2020-12): add support for contentMediaType keyword (#8640)
Refs #8513
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user