committed by
Vladimír Gorej
parent
15830794f1
commit
bf21a4ce3e
@@ -44,6 +44,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
const KeywordAllOf = useComponent("KeywordAllOf")
|
const KeywordAllOf = useComponent("KeywordAllOf")
|
||||||
const KeywordAnyOf = useComponent("KeywordAnyOf")
|
const KeywordAnyOf = useComponent("KeywordAnyOf")
|
||||||
const KeywordOneOf = useComponent("KeywordOneOf")
|
const KeywordOneOf = useComponent("KeywordOneOf")
|
||||||
|
const KeywordNot = useComponent("KeywordNot")
|
||||||
const KeywordProperties = useComponent("KeywordProperties")
|
const KeywordProperties = useComponent("KeywordProperties")
|
||||||
const KeywordType = useComponent("KeywordType")
|
const KeywordType = useComponent("KeywordType")
|
||||||
const KeywordFormat = useComponent("KeywordFormat")
|
const KeywordFormat = useComponent("KeywordFormat")
|
||||||
@@ -111,6 +112,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
<KeywordAllOf schema={schema} />
|
<KeywordAllOf schema={schema} />
|
||||||
<KeywordAnyOf schema={schema} />
|
<KeywordAnyOf schema={schema} />
|
||||||
<KeywordOneOf schema={schema} />
|
<KeywordOneOf schema={schema} />
|
||||||
|
<KeywordNot 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} />
|
||||||
@@ -132,7 +134,7 @@ const JSONSchema = ({ schema, name }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSONSchema.propTypes = {
|
JSONSchema.propTypes = {
|
||||||
name: PropTypes.string,
|
name: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||||
schema: propTypes.schema.isRequired,
|
schema: propTypes.schema.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
@import './keywords/AllOf/all-of';
|
@import './keywords/AllOf/all-of';
|
||||||
@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/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 Not = ({ schema }) => {
|
||||||
|
if (!schema?.not) return null
|
||||||
|
|
||||||
|
const JSONSchema = useComponent("JSONSchema")
|
||||||
|
const name = (
|
||||||
|
<span className="json-schema-2020-12-core-keyword json-schema-2020-12-core-keyword--not">
|
||||||
|
Not
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="json-schema-2020-12__not">
|
||||||
|
<JSONSchema name={name} schema={schema.not} />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Not.propTypes = {
|
||||||
|
schema: schema.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Not
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
.json-schema-2020-12 {
|
||||||
|
&__not {
|
||||||
|
.json-schema-2020-12-core-keyword--not {
|
||||||
|
@extend .json-schema-2020-12-core-keyword--allOf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ const Title = ({ title, schema }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Title.propTypes = {
|
Title.propTypes = {
|
||||||
title: PropTypes.string,
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
||||||
schema: schema.isRequired,
|
schema: schema.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,13 @@
|
|||||||
@include text_headline($section-models-model-title-font-color);
|
@include text_headline($section-models-model-title-font-color);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
|
& .json-schema-2020-12-core-keyword {
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
&-property {
|
&-property {
|
||||||
margin: 7px 0;
|
margin: 7px 0;
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ export const getType = (schema, processedSchemas = new WeakSet()) => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (schema.not && getType(schema.not) === "any") {
|
||||||
|
return "never"
|
||||||
|
}
|
||||||
|
|
||||||
const typeString = Array.isArray(type)
|
const typeString = Array.isArray(type)
|
||||||
? type.map((t) => (t === "array" ? getArrayType() : t)).join(" | ")
|
? type.map((t) => (t === "array" ? getArrayType() : t)).join(" | ")
|
||||||
: type && type.includes("array")
|
: type && type.includes("array")
|
||||||
@@ -125,6 +129,7 @@ export const isExpandable = (schema) => {
|
|||||||
schema?.allOf ||
|
schema?.allOf ||
|
||||||
schema?.anyOf ||
|
schema?.anyOf ||
|
||||||
schema?.oneOf ||
|
schema?.oneOf ||
|
||||||
|
schema?.not ||
|
||||||
schema?.description ||
|
schema?.description ||
|
||||||
schema?.properties
|
schema?.properties
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import Keyword$comment from "./components/keywords/$comment"
|
|||||||
import KeywordAllOf from "./components/keywords/AllOf/AllOf"
|
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 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"
|
||||||
@@ -49,6 +50,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
|||||||
KeywordAllOf,
|
KeywordAllOf,
|
||||||
KeywordAnyOf,
|
KeywordAnyOf,
|
||||||
KeywordOneOf,
|
KeywordOneOf,
|
||||||
|
KeywordNot,
|
||||||
KeywordProperties,
|
KeywordProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import Keyword$comment from "./components/keywords/$comment"
|
|||||||
import KeywordAllOf from "./components/keywords/AllOf/AllOf"
|
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 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"
|
||||||
@@ -40,6 +41,7 @@ const JSONSchema202012Plugin = () => ({
|
|||||||
JSONSchema202012KeywordAllOf: KeywordAllOf,
|
JSONSchema202012KeywordAllOf: KeywordAllOf,
|
||||||
JSONSchema202012KeywordAnyOf: KeywordAnyOf,
|
JSONSchema202012KeywordAnyOf: KeywordAnyOf,
|
||||||
JSONSchema202012KeywordOneOf: KeywordOneOf,
|
JSONSchema202012KeywordOneOf: KeywordOneOf,
|
||||||
|
JSONSchema202012KeywordNot: KeywordNot,
|
||||||
JSONSchema202012KeywordProperties: KeywordProperties,
|
JSONSchema202012KeywordProperties: KeywordProperties,
|
||||||
JSONSchema202012KeywordType: KeywordType,
|
JSONSchema202012KeywordType: KeywordType,
|
||||||
JSONSchema202012KeywordFormat: KeywordFormat,
|
JSONSchema202012KeywordFormat: KeywordFormat,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
const KeywordAllOf = getComponent("JSONSchema202012KeywordAllOf")
|
const KeywordAllOf = getComponent("JSONSchema202012KeywordAllOf")
|
||||||
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf")
|
const KeywordAnyOf = getComponent("JSONSchema202012KeywordAnyOf")
|
||||||
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf")
|
const KeywordOneOf = getComponent("JSONSchema202012KeywordOneOf")
|
||||||
|
const KeywordNot = getComponent("JSONSchema202012KeywordNot")
|
||||||
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
|
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
|
||||||
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
||||||
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
||||||
@@ -54,6 +55,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
KeywordAllOf,
|
KeywordAllOf,
|
||||||
KeywordAnyOf,
|
KeywordAnyOf,
|
||||||
KeywordOneOf,
|
KeywordOneOf,
|
||||||
|
KeywordNot,
|
||||||
KeywordProperties,
|
KeywordProperties,
|
||||||
KeywordType,
|
KeywordType,
|
||||||
KeywordFormat,
|
KeywordFormat,
|
||||||
|
|||||||
Reference in New Issue
Block a user