From 091d6cbdad1579b14fd84596cb197f06ade942a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Thu, 11 May 2023 11:10:14 +0200 Subject: [PATCH] refactor(oas31): standardize JSON Schema 2020-12 plugin extensions (#8651) Refs #8513 --- src/core/plugins/oas31/index.js | 2 +- .../wrap-components/keywords/Description.jsx} | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) rename src/core/plugins/oas31/{wrap-components/json-schema-2020-12-keyword-description.jsx => json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx} (59%) diff --git a/src/core/plugins/oas31/index.js b/src/core/plugins/oas31/index.js index f20e30a6..006380d7 100644 --- a/src/core/plugins/oas31/index.js +++ b/src/core/plugins/oas31/index.js @@ -14,7 +14,7 @@ import InfoWrapper from "./wrap-components/info" import ModelsWrapper from "./wrap-components/models" import VersionPragmaFilterWrapper from "./wrap-components/version-pragma-filter" import VersionStampWrapper from "./wrap-components/version-stamp" -import JSONSchema202012KeywordDescriptionWrapper from "./wrap-components/json-schema-2020-12-keyword-description" +import JSONSchema202012KeywordDescriptionWrapper from "./json-schema-2020-12-extensions/wrap-components/keywords/Description" import { license as selectLicense, contact as selectContact, diff --git a/src/core/plugins/oas31/wrap-components/json-schema-2020-12-keyword-description.jsx b/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx similarity index 59% rename from src/core/plugins/oas31/wrap-components/json-schema-2020-12-keyword-description.jsx rename to src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx index 87338757..af50aab6 100644 --- a/src/core/plugins/oas31/wrap-components/json-schema-2020-12-keyword-description.jsx +++ b/src/core/plugins/oas31/json-schema-2020-12-extensions/wrap-components/keywords/Description.jsx @@ -2,11 +2,11 @@ * @prettier */ import React from "react" -import { createOnlyOAS31ComponentWrapper } from "../fn" +import { createOnlyOAS31ComponentWrapper } from "../../../fn" -const JSONSchema202012KeywordDescriptionWrapper = - createOnlyOAS31ComponentWrapper(({ schema, getComponent }) => { - if (!schema.description) return null +const DescriptionWrapper = createOnlyOAS31ComponentWrapper( + ({ schema, getComponent }) => { + if (!schema?.description) return null const MarkDown = getComponent("Markdown") @@ -17,6 +17,7 @@ const JSONSchema202012KeywordDescriptionWrapper = ) - }) + } +) -export default JSONSchema202012KeywordDescriptionWrapper +export default DescriptionWrapper