diff --git a/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx b/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx index bad1399e..db7706da 100644 --- a/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx +++ b/src/core/plugins/json-schema-2020-12/components/JSONSchema/JSONSchema.jsx @@ -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 }) => { + )} diff --git a/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx b/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx new file mode 100644 index 00000000..a3e70839 --- /dev/null +++ b/src/core/plugins/json-schema-2020-12/components/keywords/$dynamicRef.jsx @@ -0,0 +1,25 @@ +/** + * @prettier + */ +import React from "react" + +import { schema } from "../../prop-types" + +const $dynamicRef = ({ schema }) => { + if (!schema?.$dynamicRef) return null + + return ( +
+ $dynamicRef + + {schema.$dynamicRef} + +
+ ) +} + +$dynamicRef.propTypes = { + schema: schema.isRequired, +} + +export default $dynamicRef diff --git a/src/core/plugins/json-schema-2020-12/fn.js b/src/core/plugins/json-schema-2020-12/fn.js index f23469e7..ed8c43d6 100644 --- a/src/core/plugins/json-schema-2020-12/fn.js +++ b/src/core/plugins/json-schema-2020-12/fn.js @@ -119,6 +119,7 @@ export const isExpandable = (schema) => { schema?.$anchor || schema?.$dynamicAnchor || schema?.$ref || + schema?.$dynamicRef || schema?.description || schema?.properties ) diff --git a/src/core/plugins/json-schema-2020-12/hoc.jsx b/src/core/plugins/json-schema-2020-12/hoc.jsx index 7b729ce4..38ce3890 100644 --- a/src/core/plugins/json-schema-2020-12/hoc.jsx +++ b/src/core/plugins/json-schema-2020-12/hoc.jsx @@ -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, diff --git a/src/core/plugins/json-schema-2020-12/index.js b/src/core/plugins/json-schema-2020-12/index.js index 40e7a9b0..0fbc263c 100644 --- a/src/core/plugins/json-schema-2020-12/index.js +++ b/src/core/plugins/json-schema-2020-12/index.js @@ -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, diff --git a/src/core/plugins/oas31/wrap-components/models.jsx b/src/core/plugins/oas31/wrap-components/models.jsx index b20a63ab..463ca6c7 100644 --- a/src/core/plugins/oas31/wrap-components/models.jsx +++ b/src/core/plugins/oas31/wrap-components/models.jsx @@ -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,