committed by
Vladimír Gorej
parent
bf21a4ce3e
commit
dea5dbb10e
@@ -45,6 +45,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
const KeywordAnyOf = useComponent("KeywordAnyOf")
|
const KeywordAnyOf = useComponent("KeywordAnyOf")
|
||||||
const KeywordOneOf = useComponent("KeywordOneOf")
|
const KeywordOneOf = useComponent("KeywordOneOf")
|
||||||
const KeywordNot = useComponent("KeywordNot")
|
const KeywordNot = useComponent("KeywordNot")
|
||||||
|
const KeywordIf = useComponent("KeywordIf")
|
||||||
const KeywordProperties = useComponent("KeywordProperties")
|
const KeywordProperties = useComponent("KeywordProperties")
|
||||||
const KeywordType = useComponent("KeywordType")
|
const KeywordType = useComponent("KeywordType")
|
||||||
const KeywordFormat = useComponent("KeywordFormat")
|
const KeywordFormat = useComponent("KeywordFormat")
|
||||||
@@ -113,6 +114,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
<KeywordAnyOf schema={schema} />
|
<KeywordAnyOf schema={schema} />
|
||||||
<KeywordOneOf schema={schema} />
|
<KeywordOneOf schema={schema} />
|
||||||
<KeywordNot schema={schema} />
|
<KeywordNot schema={schema} />
|
||||||
|
<KeywordIf schema={schema} />
|
||||||
<Keyword$schema schema={schema} />
|
<Keyword$schema schema={schema} />
|
||||||
<Keyword$vocabulary schema={schema} />
|
<Keyword$vocabulary schema={schema} />
|
||||||
<Keyword$id schema={schema} />
|
<Keyword$id schema={schema} />
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
@import './keywords/AnyOf/any-of';
|
@import './keywords/AnyOf/any-of';
|
||||||
@import './keywords/OneOf/one-of';
|
@import './keywords/OneOf/one-of';
|
||||||
@import './keywords/Not/not';
|
@import './keywords/Not/not';
|
||||||
|
@import './keywords/If/if';
|
||||||
@import './keywords/Type/type';
|
@import './keywords/Type/type';
|
||||||
@import './keywords/Format/format';
|
@import './keywords/Format/format';
|
||||||
@import './keywords/Description/description';
|
@import './keywords/Description/description';
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
|
import React from "react"
|
||||||
|
|
||||||
|
import { schema } from "../../../prop-types"
|
||||||
|
import { useComponent } from "../../../hooks"
|
||||||
|
|
||||||
|
const If = ({ schema }) => {
|
||||||
|
if (!schema?.if) return null
|
||||||
|
|
||||||
|
const JSONSchema = useComponent("JSONSchema")
|
||||||
|
const name = (
|
||||||
|
<span className="json-schema-2020-12-core-keyword json-schema-2020-12-core-keyword--if">
|
||||||
|
If
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="json-schema-2020-12__if">
|
||||||
|
<JSONSchema name={name} schema={schema.if} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
If.propTypes = {
|
||||||
|
schema: schema.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default If
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
.json-schema-2020-12 {
|
||||||
|
&__if {
|
||||||
|
.json-schema-2020-12-core-keyword--if {
|
||||||
|
@extend .json-schema-2020-12-core-keyword--allOf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -130,6 +130,7 @@ export const isExpandable = (schema) => {
|
|||||||
schema?.anyOf ||
|
schema?.anyOf ||
|
||||||
schema?.oneOf ||
|
schema?.oneOf ||
|
||||||
schema?.not ||
|
schema?.not ||
|
||||||
|
schema?.if ||
|
||||||
schema?.description ||
|
schema?.description ||
|
||||||
schema?.properties
|
schema?.properties
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import KeywordAllOf from "./components/keywords/AllOf/AllOf"
|
|||||||
import KeywordAnyOf from "./components/keywords/AnyOf/AnyOf"
|
import KeywordAnyOf from "./components/keywords/AnyOf/AnyOf"
|
||||||
import KeywordOneOf from "./components/keywords/OneOf/OneOf"
|
import KeywordOneOf from "./components/keywords/OneOf/OneOf"
|
||||||
import KeywordNot from "./components/keywords/Not/Not"
|
import KeywordNot from "./components/keywords/Not/Not"
|
||||||
|
import KeywordIf from "./components/keywords/If/If"
|
||||||
import KeywordProperties from "./components/keywords/Properties/Properties"
|
import KeywordProperties from "./components/keywords/Properties/Properties"
|
||||||
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"
|
||||||
@@ -51,6 +52,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
|||||||
KeywordAnyOf,
|
KeywordAnyOf,
|
||||||
KeywordOneOf,
|
KeywordOneOf,
|
||||||
KeywordNot,
|
KeywordNot,
|
||||||
|
KeywordIf,
|
||||||
KeywordProperties,
|
KeywordProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import KeywordAllOf from "./components/keywords/AllOf/AllOf"
|
|||||||
import KeywordAnyOf from "./components/keywords/AnyOf/AnyOf"
|
import KeywordAnyOf from "./components/keywords/AnyOf/AnyOf"
|
||||||
import KeywordOneOf from "./components/keywords/OneOf/OneOf"
|
import KeywordOneOf from "./components/keywords/OneOf/OneOf"
|
||||||
import KeywordNot from "./components/keywords/Not/Not"
|
import KeywordNot from "./components/keywords/Not/Not"
|
||||||
|
import KeywordIf from "./components/keywords/If/If"
|
||||||
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"
|
||||||
@@ -42,6 +43,7 @@ const JSONSchema202012Plugin = () => ({
|
|||||||
JSONSchema202012KeywordAnyOf: KeywordAnyOf,
|
JSONSchema202012KeywordAnyOf: KeywordAnyOf,
|
||||||
JSONSchema202012KeywordOneOf: KeywordOneOf,
|
JSONSchema202012KeywordOneOf: KeywordOneOf,
|
||||||
JSONSchema202012KeywordNot: KeywordNot,
|
JSONSchema202012KeywordNot: KeywordNot,
|
||||||
|
JSONSchema202012KeywordIf: KeywordIf,
|
||||||
JSONSchema202012KeywordProperties: KeywordProperties,
|
JSONSchema202012KeywordProperties: KeywordProperties,
|
||||||
JSONSchema202012KeywordType: KeywordType,
|
JSONSchema202012KeywordType: KeywordType,
|
||||||
JSONSchema202012KeywordFormat: KeywordFormat,
|
JSONSchema202012KeywordFormat: KeywordFormat,
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf")
|
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf")
|
||||||
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf")
|
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf")
|
||||||
const KeywordNot = getComponent("JSONSchema202012KeywordNot")
|
const KeywordNot = getComponent("JSONSchema202012KeywordNot")
|
||||||
|
const KeywordIf = getComponent("JSONSchema202012KeywordIf")
|
||||||
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
|
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
|
||||||
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
||||||
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
||||||
@@ -56,6 +57,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
KeywordAnyOf,
|
KeywordAnyOf,
|
||||||
KeywordOneOf,
|
KeywordOneOf,
|
||||||
KeywordNot,
|
KeywordNot,
|
||||||
|
KeywordIf,
|
||||||
KeywordProperties,
|
KeywordProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
|
|||||||
Reference in New Issue
Block a user