feat(json-schema-2020-12): add support for unevaluatedProperties
Refs #8513
This commit is contained in:
committed by
Vladimír Gorej
parent
aba7f986ad
commit
3a5a605c8e
@@ -59,6 +59,9 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
)
|
)
|
||||||
const KeywordPropertyNames = useComponent("KeywordPropertyNames")
|
const KeywordPropertyNames = useComponent("KeywordPropertyNames")
|
||||||
const KeywordUnevaluatedItems = useComponent("KeywordUnevaluatedItems")
|
const KeywordUnevaluatedItems = useComponent("KeywordUnevaluatedItems")
|
||||||
|
const KeywordUnevaluatedProperties = useComponent(
|
||||||
|
"KeywordUnevaluatedProperties"
|
||||||
|
)
|
||||||
const KeywordType = useComponent("KeywordType")
|
const KeywordType = useComponent("KeywordType")
|
||||||
const KeywordFormat = useComponent("KeywordFormat")
|
const KeywordFormat = useComponent("KeywordFormat")
|
||||||
const KeywordTitle = useComponent("KeywordTitle")
|
const KeywordTitle = useComponent("KeywordTitle")
|
||||||
@@ -124,6 +127,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
<KeywordProperties schema={schema} />
|
<KeywordProperties schema={schema} />
|
||||||
<KeywordPatternProperties schema={schema} />
|
<KeywordPatternProperties schema={schema} />
|
||||||
<KeywordAdditionalProperties schema={schema} />
|
<KeywordAdditionalProperties schema={schema} />
|
||||||
|
<KeywordUnevaluatedProperties schema={schema} />
|
||||||
<KeywordPropertyNames schema={schema} />
|
<KeywordPropertyNames schema={schema} />
|
||||||
<KeywordAllOf schema={schema} />
|
<KeywordAllOf schema={schema} />
|
||||||
<KeywordAnyOf schema={schema} />
|
<KeywordAnyOf schema={schema} />
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
|
import React from "react"
|
||||||
|
|
||||||
|
import { schema } from "../../prop-types"
|
||||||
|
import { useFn, useComponent } from "../../hooks"
|
||||||
|
|
||||||
|
const UnevaluatedProperties = ({ schema }) => {
|
||||||
|
const fn = useFn()
|
||||||
|
|
||||||
|
if (!fn.hasKeyword(schema, "unevaluatedProperties")) return null
|
||||||
|
|
||||||
|
const { unevaluatedProperties } = schema
|
||||||
|
const JSONSchema = useComponent("JSONSchema")
|
||||||
|
const name = (
|
||||||
|
<span className="json-schema-2020-12-keyword__name json-schema-2020-12-keyword__name--primary">
|
||||||
|
Unevaluated properties
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="json-schema-2020-12-keyword json-schema-2020-12-keyword--unevaluatedProperties">
|
||||||
|
<JSONSchema name={name} schema={unevaluatedProperties} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
UnevaluatedProperties.propTypes = {
|
||||||
|
schema: schema.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default UnevaluatedProperties
|
||||||
@@ -158,6 +158,7 @@ export const isExpandable = (schema) => {
|
|||||||
fn.hasKeyword(schema, "additionalProperties") ||
|
fn.hasKeyword(schema, "additionalProperties") ||
|
||||||
fn.hasKeyword(schema, "propertyNames") ||
|
fn.hasKeyword(schema, "propertyNames") ||
|
||||||
fn.hasKeyword(schema, "unevaluatedItems") ||
|
fn.hasKeyword(schema, "unevaluatedItems") ||
|
||||||
|
fn.hasKeyword(schema, "unevaluatedProperties") ||
|
||||||
schema?.description
|
schema?.description
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import KeywordPatternProperties from "./components/keywords/PatternProperties/Pa
|
|||||||
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
||||||
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
||||||
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
|
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
|
||||||
|
import KeywordUnevaluatedProperties from "./components/keywords/UnevaluatedProperties"
|
||||||
import KeywordType from "./components/keywords/Type/Type"
|
import KeywordType from "./components/keywords/Type/Type"
|
||||||
import KeywordFormat from "./components/keywords/Format/Format"
|
import KeywordFormat from "./components/keywords/Format/Format"
|
||||||
import KeywordTitle from "./components/keywords/Title/Title"
|
import KeywordTitle from "./components/keywords/Title/Title"
|
||||||
@@ -75,6 +76,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
|||||||
KeywordAdditionalProperties,
|
KeywordAdditionalProperties,
|
||||||
KeywordPropertyNames,
|
KeywordPropertyNames,
|
||||||
KeywordUnevaluatedItems,
|
KeywordUnevaluatedItems,
|
||||||
|
KeywordUnevaluatedProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
KeywordTitle,
|
KeywordTitle,
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import KeywordPatternProperties from "./components/keywords/PatternProperties/Pa
|
|||||||
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
import KeywordAdditionalProperties from "./components/keywords/AdditionalProperties"
|
||||||
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
import KeywordPropertyNames from "./components/keywords/PropertyNames"
|
||||||
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
|
import KeywordUnevaluatedItems from "./components/keywords/UnevaluatedItems"
|
||||||
|
import KeywordUnevaluatedProperties from "./components/keywords/UnevaluatedProperties"
|
||||||
import KeywordType from "./components/keywords/Type/Type"
|
import KeywordType from "./components/keywords/Type/Type"
|
||||||
import KeywordFormat from "./components/keywords/Format/Format"
|
import KeywordFormat from "./components/keywords/Format/Format"
|
||||||
import KeywordTitle from "./components/keywords/Title/Title"
|
import KeywordTitle from "./components/keywords/Title/Title"
|
||||||
@@ -65,6 +66,7 @@ const JSONSchema202012Plugin = () => ({
|
|||||||
JSONSchema202012KeywordAdditionalProperties: KeywordAdditionalProperties,
|
JSONSchema202012KeywordAdditionalProperties: KeywordAdditionalProperties,
|
||||||
JSONSchema202012KeywordPropertyNames: KeywordPropertyNames,
|
JSONSchema202012KeywordPropertyNames: KeywordPropertyNames,
|
||||||
JSONSchema202012KeywordUnevaluatedItems: KeywordUnevaluatedItems,
|
JSONSchema202012KeywordUnevaluatedItems: KeywordUnevaluatedItems,
|
||||||
|
JSONSchema202012KeywordUnevaluatedProperties: KeywordUnevaluatedProperties,
|
||||||
JSONSchema202012KeywordType: KeywordType,
|
JSONSchema202012KeywordType: KeywordType,
|
||||||
JSONSchema202012KeywordFormat: KeywordFormat,
|
JSONSchema202012KeywordFormat: KeywordFormat,
|
||||||
JSONSchema202012KeywordTitle: KeywordTitle,
|
JSONSchema202012KeywordTitle: KeywordTitle,
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
const KeywordUnevaluatedItems = getComponent(
|
const KeywordUnevaluatedItems = getComponent(
|
||||||
"JSONSchema202012KeywordUnevaluatedItems"
|
"JSONSchema202012KeywordUnevaluatedItems"
|
||||||
)
|
)
|
||||||
|
const KeywordUnevaluatedProperties = getComponent(
|
||||||
|
"JSONSchema202012KeywordUnevaluatedProperties"
|
||||||
|
)
|
||||||
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
||||||
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
||||||
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle")
|
const KeywordTitle = getComponent("JSONSchema202012KeywordTitle")
|
||||||
@@ -89,6 +92,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
KeywordAdditionalProperties,
|
KeywordAdditionalProperties,
|
||||||
KeywordPropertyNames,
|
KeywordPropertyNames,
|
||||||
KeywordUnevaluatedItems,
|
KeywordUnevaluatedItems,
|
||||||
|
KeywordUnevaluatedProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
KeywordTitle,
|
KeywordTitle,
|
||||||
|
|||||||
Reference in New Issue
Block a user