diff --git a/src/core/plugins/oas31/index.js b/src/core/plugins/oas31/index.js
index 2b235c92..e2f6bc03 100644
--- a/src/core/plugins/oas31/index.js
+++ b/src/core/plugins/oas31/index.js
@@ -53,6 +53,7 @@ import { selectLicenseUrl as selectOAS31LicenseUrl } from "./selectors"
import JSONSchema202012KeywordExample from "./json-schema-2020-12-extensions/components/keywords/Example"
import JSONSchema202012KeywordXml from "./json-schema-2020-12-extensions/components/keywords/Xml"
import JSONSchema202012KeywordDiscriminator from "./json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator"
+import JSONSchema202012KeywordExternalDocs from "./json-schema-2020-12-extensions/components/keywords/ExternalDocs"
import JSONSchema202012KeywordDescriptionWrapper from "./json-schema-2020-12-extensions/wrap-components/keywords/Description"
import JSONSchema202012KeywordDefaultWrapper from "./json-schema-2020-12-extensions/wrap-components/keywords/Default"
import { makeIsExpandable } from "./json-schema-2020-12-extensions/fn"
@@ -88,6 +89,7 @@ const OAS31Plugin = ({ getSystem }) => {
JSONSchema202012KeywordExample,
JSONSchema202012KeywordXml,
JSONSchema202012KeywordDiscriminator,
+ JSONSchema202012KeywordExternalDocs,
},
wrapComponents: {
InfoContainer: InfoWrapper,
diff --git a/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx b/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx
index 21c13b85..900f076a 100644
--- a/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx
+++ b/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Discriminator/Discriminator.jsx
@@ -52,6 +52,9 @@ const Discriminator = ({ schema, getSystem }) => {
{discriminator.propertyName}
)}
+
+ object
+
{
+ const externalDocs = schema?.externalDocs || {}
+ const { fn, getComponent } = getSystem()
+ const { useIsExpandedDeeply, useComponent } = fn.jsonSchema202012
+ const isExpandedDeeply = useIsExpandedDeeply()
+ const [expanded, setExpanded] = useState(isExpandedDeeply)
+ const [expandedDeeply, setExpandedDeeply] = useState(false)
+ const Accordion = useComponent("Accordion")
+ const ExpandDeepButton = useComponent("ExpandDeepButton")
+ const KeywordDescription = getComponent("JSONSchema202012KeywordDescription")
+ const Link = getComponent("Link")
+ const JSONSchemaDeepExpansionContext = getComponent(
+ "JSONSchema202012DeepExpansionContext"
+ )()
+
+ /**
+ * Event handlers.
+ */
+ const handleExpansion = useCallback(() => {
+ setExpanded((prev) => !prev)
+ }, [])
+ const handleExpansionDeep = useCallback((e, expandedDeepNew) => {
+ setExpanded(expandedDeepNew)
+ setExpandedDeeply(expandedDeepNew)
+ }, [])
+
+ /**
+ * Rendering.
+ */
+ if (Object.keys(externalDocs).length === 0) {
+ return null
+ }
+
+ return (
+
+
+
+
+ External documentation
+
+
+
+
+ object
+
+
+
+
+ )
+}
+
+ExternalDocs.propTypes = {
+ schema: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
+ getSystem: PropTypes.func.isRequired,
+}
+
+export default ExternalDocs
diff --git a/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx b/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx
index 1b15dbbf..723aa8bf 100644
--- a/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx
+++ b/src/core/plugins/oas31/json-schema-2020-12-extensions/components/keywords/Xml.jsx
@@ -65,8 +65,8 @@ const Xml = ({ schema, getSystem }) => {
>
{expanded && (
<>
- -
- {xml.name && (
+ {xml.name && (
+
-
name
@@ -75,10 +75,11 @@ const Xml = ({ schema, getSystem }) => {
{xml.name}
- )}
-
- -
- {xml.namespace && (
+
+ )}
+
+ {xml.namespace && (
+ -
namespace
@@ -87,10 +88,11 @@ const Xml = ({ schema, getSystem }) => {
{xml.namespace}
- )}
-
- -
- {xml.prefix && (
+
+ )}
+
+ {xml.prefix && (
+ -
prefix
@@ -99,8 +101,8 @@ const Xml = ({ schema, getSystem }) => {
{xml.prefix}
- )}
-
+
+ )}
>
)}
diff --git a/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js b/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js
index 3693ada2..7d9b0cfd 100644
--- a/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js
+++ b/src/core/plugins/oas31/json-schema-2020-12-extensions/fn.js
@@ -9,5 +9,9 @@ export const makeIsExpandable = (original, { fn }) => {
const { hasKeyword } = fn.jsonSchema202012
return (schema) =>
- original(schema) || hasKeyword(schema, "example") || schema?.xml
+ original(schema) ||
+ hasKeyword(schema, "example") ||
+ schema?.xml ||
+ schema?.discriminator ||
+ schema?.externalDocs
}
diff --git a/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Default.jsx b/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Default.jsx
index 92c46ff9..abd3b9dc 100644
--- a/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Default.jsx
+++ b/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Default.jsx
@@ -12,12 +12,16 @@ const DefaultWrapper = createOnlyOAS31ComponentWrapper(
)
const KeywordXml = getComponent("JSONSchema202012KeywordXml")
const KeywordExample = getComponent("JSONSchema202012KeywordExample")
+ const KeywordExternalDocs = getComponent(
+ "JSONSchema202012KeywordExternalDocs"
+ )
return (
<>
+
>
)