feat(json-schema-2020-12): add support for writeOnly keyword (#8650)
Refs #8513
This commit is contained in:
@@ -75,6 +75,7 @@ const JSONSchema = forwardRef(
|
|||||||
const KeywordDefault = useComponent("KeywordDefault")
|
const KeywordDefault = useComponent("KeywordDefault")
|
||||||
const KeywordDeprecated = useComponent("KeywordDeprecated")
|
const KeywordDeprecated = useComponent("KeywordDeprecated")
|
||||||
const KeywordReadOnly = useComponent("KeywordReadOnly")
|
const KeywordReadOnly = useComponent("KeywordReadOnly")
|
||||||
|
const KeywordWriteOnly = useComponent("KeywordWriteOnly")
|
||||||
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
const ExpandDeepButton = useComponent("ExpandDeepButton")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,6 +137,7 @@ const JSONSchema = forwardRef(
|
|||||||
)}
|
)}
|
||||||
<KeywordDeprecated schema={schema} />
|
<KeywordDeprecated schema={schema} />
|
||||||
<KeywordReadOnly schema={schema} />
|
<KeywordReadOnly schema={schema} />
|
||||||
|
<KeywordWriteOnly schema={schema} />
|
||||||
<KeywordType schema={schema} isCircular={isCircular} />
|
<KeywordType schema={schema} isCircular={isCircular} />
|
||||||
{constraints.length > 0 &&
|
{constraints.length > 0 &&
|
||||||
constraints.map((constraint) => (
|
constraints.map((constraint) => (
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { schema } from "../../../prop-types"
|
|||||||
const ReadOnly = ({ schema }) => {
|
const ReadOnly = ({ schema }) => {
|
||||||
if (schema?.readOnly !== true) return null
|
if (schema?.readOnly !== true) return null
|
||||||
|
|
||||||
return <span className="json-schema-2020-12__readonly">read-only</span>
|
return <span className="json-schema-2020-12__readOnly">read-only</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadOnly.propTypes = {
|
ReadOnly.propTypes = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.json-schema-2020-12 {
|
.json-schema-2020-12 {
|
||||||
&__readonly {
|
&__readOnly {
|
||||||
@extend .json-schema-2020-12__deprecated;
|
@extend .json-schema-2020-12__deprecated;
|
||||||
color: gray;
|
color: gray;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* @prettier
|
||||||
|
*/
|
||||||
|
import React from "react"
|
||||||
|
|
||||||
|
import { schema } from "../../../prop-types"
|
||||||
|
|
||||||
|
const WriteOnly = ({ schema }) => {
|
||||||
|
if (schema?.writeOnly !== true) return null
|
||||||
|
|
||||||
|
return <span className="json-schema-2020-12__writeOnly">write-only</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteOnly.propTypes = {
|
||||||
|
schema: schema.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WriteOnly
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.json-schema-2020-12 {
|
||||||
|
&__writeOnly {
|
||||||
|
@extend .json-schema-2020-12__readOnly;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,3 +76,4 @@
|
|||||||
@import './DependentRequired/dependent-required';
|
@import './DependentRequired/dependent-required';
|
||||||
@import './Deprecated/deprecated';
|
@import './Deprecated/deprecated';
|
||||||
@import './ReadOnly/read-only';
|
@import './ReadOnly/read-only';
|
||||||
|
@import './WriteOnly/write-only';
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import KeywordDescription from "./components/keywords/Description/Description"
|
|||||||
import KeywordDefault from "./components/keywords/Default"
|
import KeywordDefault from "./components/keywords/Default"
|
||||||
import KeywordDeprecated from "./components/keywords/Deprecated/Deprecated"
|
import KeywordDeprecated from "./components/keywords/Deprecated/Deprecated"
|
||||||
import KeywordReadOnly from "./components/keywords/ReadOnly/ReadOnly"
|
import KeywordReadOnly from "./components/keywords/ReadOnly/ReadOnly"
|
||||||
|
import KeywordWriteOnly from "./components/keywords/WriteOnly/WriteOnly"
|
||||||
import Accordion from "./components/Accordion/Accordion"
|
import Accordion from "./components/Accordion/Accordion"
|
||||||
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
|
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
|
||||||
import ChevronRightIcon from "./components/icons/ChevronRight"
|
import ChevronRightIcon from "./components/icons/ChevronRight"
|
||||||
@@ -98,6 +99,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
|||||||
KeywordDefault,
|
KeywordDefault,
|
||||||
KeywordDeprecated,
|
KeywordDeprecated,
|
||||||
KeywordReadOnly,
|
KeywordReadOnly,
|
||||||
|
KeywordWriteOnly,
|
||||||
Accordion,
|
Accordion,
|
||||||
ExpandDeepButton,
|
ExpandDeepButton,
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import KeywordDescription from "./components/keywords/Description/Description"
|
|||||||
import KeywordDefault from "./components/keywords/Default"
|
import KeywordDefault from "./components/keywords/Default"
|
||||||
import KeywordDeprecated from "./components/keywords/Deprecated/Deprecated"
|
import KeywordDeprecated from "./components/keywords/Deprecated/Deprecated"
|
||||||
import KeywordReadOnly from "./components/keywords/ReadOnly/ReadOnly"
|
import KeywordReadOnly from "./components/keywords/ReadOnly/ReadOnly"
|
||||||
|
import KeywordWriteOnly from "./components/keywords/WriteOnly/WriteOnly"
|
||||||
import Accordion from "./components/Accordion/Accordion"
|
import Accordion from "./components/Accordion/Accordion"
|
||||||
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
|
import ExpandDeepButton from "./components/ExpandDeepButton/ExpandDeepButton"
|
||||||
import ChevronRightIcon from "./components/icons/ChevronRight"
|
import ChevronRightIcon from "./components/icons/ChevronRight"
|
||||||
@@ -85,6 +86,7 @@ const JSONSchema202012Plugin = () => ({
|
|||||||
JSONSchema202012KeywordDefault: KeywordDefault,
|
JSONSchema202012KeywordDefault: KeywordDefault,
|
||||||
JSONSchema202012KeywordDeprecated: KeywordDeprecated,
|
JSONSchema202012KeywordDeprecated: KeywordDeprecated,
|
||||||
JSONSchema202012KeywordReadOnly: KeywordReadOnly,
|
JSONSchema202012KeywordReadOnly: KeywordReadOnly,
|
||||||
|
JSONSchema202012KeywordWriteOnly: KeywordWriteOnly,
|
||||||
JSONSchema202012Accordion: Accordion,
|
JSONSchema202012Accordion: Accordion,
|
||||||
JSONSchema202012ExpandDeepButton: ExpandDeepButton,
|
JSONSchema202012ExpandDeepButton: ExpandDeepButton,
|
||||||
JSONSchema202012ChevronRightIcon: ChevronRightIcon,
|
JSONSchema202012ChevronRightIcon: ChevronRightIcon,
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
const KeywordDefault = getComponent("JSONSchema202012KeywordDefault")
|
const KeywordDefault = getComponent("JSONSchema202012KeywordDefault")
|
||||||
const KeywordDeprecated = getComponent("JSONSchema202012KeywordDeprecated")
|
const KeywordDeprecated = getComponent("JSONSchema202012KeywordDeprecated")
|
||||||
const KeywordReadOnly = getComponent("JSONSchema202012KeywordReadOnly")
|
const KeywordReadOnly = getComponent("JSONSchema202012KeywordReadOnly")
|
||||||
|
const KeywordWriteOnly = getComponent("JSONSchema202012KeywordWriteOnly")
|
||||||
const Accordion = getComponent("JSONSchema202012Accordion")
|
const Accordion = getComponent("JSONSchema202012Accordion")
|
||||||
const ExpandDeepButton = getComponent("JSONSchema202012ExpandDeepButton")
|
const ExpandDeepButton = getComponent("JSONSchema202012ExpandDeepButton")
|
||||||
const ChevronRightIcon = getComponent("JSONSchema202012ChevronRightIcon")
|
const ChevronRightIcon = getComponent("JSONSchema202012ChevronRightIcon")
|
||||||
@@ -122,6 +123,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
|||||||
KeywordDefault,
|
KeywordDefault,
|
||||||
KeywordDeprecated,
|
KeywordDeprecated,
|
||||||
KeywordReadOnly,
|
KeywordReadOnly,
|
||||||
|
KeywordWriteOnly,
|
||||||
Accordion,
|
Accordion,
|
||||||
ExpandDeepButton,
|
ExpandDeepButton,
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
|
|||||||
Reference in New Issue
Block a user