feat(json-schema-2020-12): add support for dynamicRef keyword
Refs #8513
This commit is contained in:
committed by
Vladimír Gorej
parent
6c5a126a46
commit
51a7f4eefd
@@ -38,6 +38,7 @@ const JSONSchema = ({ schema, name }) => {
|
||||
const Keyword$anchor = useComponent("Keyword$anchor")
|
||||
const Keyword$dynamicAnchor = useComponent("Keyword$dynamicAnchor")
|
||||
const Keyword$ref = useComponent("Keyword$ref")
|
||||
const Keyword$dynamicRef = useComponent("Keyword$dynamicRef")
|
||||
const KeywordProperties = useComponent("KeywordProperties")
|
||||
const KeywordType = useComponent("KeywordType")
|
||||
const KeywordFormat = useComponent("KeywordFormat")
|
||||
@@ -107,6 +108,7 @@ const JSONSchema = ({ schema, name }) => {
|
||||
<Keyword$anchor schema={schema} />
|
||||
<Keyword$dynamicAnchor schema={schema} />
|
||||
<Keyword$ref schema={schema} />
|
||||
<Keyword$dynamicRef schema={schema} />
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
import React from "react"
|
||||
|
||||
import { schema } from "../../prop-types"
|
||||
|
||||
const $dynamicRef = ({ schema }) => {
|
||||
if (!schema?.$dynamicRef) return null
|
||||
|
||||
return (
|
||||
<div className="json-schema-2020-12__$dynamicRef">
|
||||
<span className="json-schema-2020-12-core-keyword">$dynamicRef</span>
|
||||
<span className="json-schema-2020-12-core-keyword__value">
|
||||
{schema.$dynamicRef}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
$dynamicRef.propTypes = {
|
||||
schema: schema.isRequired,
|
||||
}
|
||||
|
||||
export default $dynamicRef
|
||||
@@ -119,6 +119,7 @@ export const isExpandable = (schema) => {
|
||||
schema?.$anchor ||
|
||||
schema?.$dynamicAnchor ||
|
||||
schema?.$ref ||
|
||||
schema?.$dynamicRef ||
|
||||
schema?.description ||
|
||||
schema?.properties
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@ import Keyword$id from "./components/keywords/$id"
|
||||
import Keyword$anchor from "./components/keywords/$anchor"
|
||||
import Keyword$dynamicAnchor from "./components/keywords/$dynamicAnchor"
|
||||
import Keyword$ref from "./components/keywords/$ref"
|
||||
import Keyword$dynamicRef from "./components/keywords/$dynamicRef"
|
||||
import KeywordProperties from "./components/keywords/Properties"
|
||||
import KeywordType from "./components/keywords/Type/Type"
|
||||
import KeywordFormat from "./components/keywords/Format/Format"
|
||||
@@ -37,6 +38,7 @@ export const withJSONSchemaContext = (Component, overrides = {}) => {
|
||||
Keyword$anchor,
|
||||
Keyword$dynamicAnchor,
|
||||
Keyword$ref,
|
||||
Keyword$dynamicRef,
|
||||
KeywordProperties,
|
||||
KeywordType,
|
||||
KeywordFormat,
|
||||
|
||||
@@ -9,6 +9,7 @@ import Keyword$id from "./components/keywords/$id"
|
||||
import Keyword$anchor from "./components/keywords/$anchor"
|
||||
import Keyword$dynamicAnchor from "./components/keywords/$dynamicAnchor"
|
||||
import Keyword$ref from "./components/keywords/$ref"
|
||||
import Keyword$dynamicRef from "./components/keywords/$dynamicRef"
|
||||
import KeywordType from "./components/keywords/Type/Type"
|
||||
import KeywordFormat from "./components/keywords/Format/Format"
|
||||
import KeywordTitle from "./components/keywords/Title/Title"
|
||||
@@ -28,6 +29,7 @@ const JSONSchema202012Plugin = () => ({
|
||||
JSONSchema202012Keyword$anchor: Keyword$anchor,
|
||||
JSONSchema202012Keyword$dynamicAnchor: Keyword$dynamicAnchor,
|
||||
JSONSchema202012Keyword$ref: Keyword$ref,
|
||||
JSONSchema202012Keyword$dynamicRef: Keyword$dynamicRef,
|
||||
JSONSchema202012KeywordProperties: KeywordProperties,
|
||||
JSONSchema202012KeywordType: KeywordType,
|
||||
JSONSchema202012KeywordFormat: KeywordFormat,
|
||||
|
||||
@@ -17,6 +17,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
||||
"JSONSchema202012Keyword$dynamicAnchor"
|
||||
)
|
||||
const Keyword$ref = getComponent("JSONSchema202012Keyword$ref")
|
||||
const Keyword$dynamicRef = getComponent("JSONSchema202012Keyword$dynamicRef")
|
||||
const KeywordProperties = getComponent("JSONSchema202012KeywordProperties")
|
||||
const KeywordType = getComponent("JSONSchema202012KeywordType")
|
||||
const KeywordFormat = getComponent("JSONSchema202012KeywordFormat")
|
||||
@@ -42,6 +43,7 @@ const ModelsWrapper = createOnlyOAS31ComponentWrapper(({ getSystem }) => {
|
||||
Keyword$anchor,
|
||||
Keyword$dynamicAnchor,
|
||||
Keyword$ref,
|
||||
Keyword$dynamicRef,
|
||||
KeywordProperties,
|
||||
KeywordType,
|
||||
KeywordFormat,
|
||||
|
||||
Reference in New Issue
Block a user