From d7bbe208ff785c5c17886f58e5f927b9e05c4cf0 Mon Sep 17 00:00:00 2001 From: Steven Serrata <9343811+sserrata@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:56:56 -0400 Subject: [PATCH] Ensure qualifiers are rendered for polymorphic/primitive properties (#765) * ensure qualifiers are rendered for polymorphic properties * update createSchema test --- .../__snapshots__/createSchema.test.ts.snap | 32 +++---------------- .../src/markdown/createSchema.ts | 26 ++++++++++++--- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/__snapshots__/createSchema.test.ts.snap b/packages/docusaurus-plugin-openapi-docs/src/markdown/__snapshots__/createSchema.test.ts.snap index 66c9fb716..85994de2e 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/__snapshots__/createSchema.test.ts.snap +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/__snapshots__/createSchema.test.ts.snap @@ -35,13 +35,7 @@ Array [ Array [ -
+
string
  • @@ -57,35 +51,17 @@ Array [
  • -
    +
    boolean
    -
    +
    number
    -
    +
    string
    diff --git a/packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts b/packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts index 5c93db087..6cd888885 100644 --- a/packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts +++ b/packages/docusaurus-plugin-openapi-docs/src/markdown/createSchema.ts @@ -817,9 +817,18 @@ export function createNodes( style: { marginTop: ".5rem", marginBottom: ".5rem", - marginLeft: "1rem", }, - children: createDescription(schema.type), + children: [ + createDescription(schema.type), + guard(getQualifierMessage(schema), (message) => + create("div", { + style: { + paddingTop: "1rem", + }, + children: createDescription(message), + }) + ), + ], }); } @@ -829,9 +838,18 @@ export function createNodes( style: { marginTop: ".5rem", marginBottom: ".5rem", - marginLeft: "1rem", }, - children: [createDescription(schema)], + children: [ + createDescription(schema), + guard(getQualifierMessage(schema), (message) => + create("div", { + style: { + paddingTop: "1rem", + }, + children: createDescription(message), + }) + ), + ], }); }