From c4eed88617a8019a31f504a7571b08c767cf8ecb Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Fri, 6 Jun 2025 11:32:15 +0200 Subject: [PATCH 1/5] ft: show the schema tab in the Try it Out mode --- .../plugins/oas3/components/request-body.jsx | 48 ++++++++----------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index b85f597d1ef..dbff056179b 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -282,35 +282,25 @@ const RequestBody = ({ /> ) : null } - { - isExecute ? ( -
- -
- ) : ( - - {stringify(requestBodyValue) || sampleRequestBody} - - } - includeWriteOnly={true} - /> - ) - } + : + {stringify(requestBodyValue) || sampleRequestBody} + } + includeWriteOnly={true} + /> { sampleForMediaType ? ( Date: Fri, 6 Jun 2025 20:26:16 +0200 Subject: [PATCH 2/5] ft: show the schema tab in the Try it Out mode --- .../plugins/oas3/components/request-body.jsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index dbff056179b..a05b1604bd7 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -262,6 +262,15 @@ const RequestBody = ({ if (testValueForJson) { language = "json" } + let example = isExecute ? : + {stringify(requestBodyValue) || sampleRequestBody} + return
{ requestBodyDescription && @@ -290,15 +299,7 @@ const RequestBody = ({ isExecute={isExecute} schema={mediaTypeValue.get("schema")} specPath={specPath.push("content", contentType)} - example={isExecute ? : - {stringify(requestBodyValue) || sampleRequestBody} - } + example={example} includeWriteOnly={true} /> { From 0745707b7e53d6e6ac8b4b89968d0c287f617632 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Fri, 6 Jun 2025 20:39:27 +0200 Subject: [PATCH 3/5] ft: show the schema tab in the Try it Out mode --- .../e2e/features/schema-rendering.cy.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/e2e-cypress/e2e/features/schema-rendering.cy.js diff --git a/test/e2e-cypress/e2e/features/schema-rendering.cy.js b/test/e2e-cypress/e2e/features/schema-rendering.cy.js new file mode 100644 index 00000000000..c2b01f4eeb3 --- /dev/null +++ b/test/e2e-cypress/e2e/features/schema-rendering.cy.js @@ -0,0 +1,25 @@ +describe("OpenAPI 3.0 Schema rendering", () => { + it("should render the Schema tab in Try it out mode for request body", () => { + cy + .visit("?url=/documents/features/oas3-xml.json") + .get("#operations-default-post_foo") + .click() + .get(".btn.try-out__btn") + .click() + .get('.opblock-section-request-body') + .within(() => { + cy.contains('button', 'Schema') + .should('exist') + .and('be.visible') + .click() + + cy + .get('[data-name="modelPanel"]') + .should('be.visible') + + cy + .get('[data-name="examplePanel"]') + .should('not.exist') + }) + }) +}) From 0d1671646403c3b89cb5cc94faccf38068971e11 Mon Sep 17 00:00:00 2001 From: "lukasz.zazulak" Date: Fri, 6 Jun 2025 20:40:18 +0200 Subject: [PATCH 4/5] ft: show the schema tab in the Try it Out mode --- src/core/plugins/oas3/components/request-body.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/plugins/oas3/components/request-body.jsx b/src/core/plugins/oas3/components/request-body.jsx index a05b1604bd7..6490a3c1dc8 100644 --- a/src/core/plugins/oas3/components/request-body.jsx +++ b/src/core/plugins/oas3/components/request-body.jsx @@ -262,7 +262,7 @@ const RequestBody = ({ if (testValueForJson) { language = "json" } - let example = isExecute ? Date: Fri, 6 Jun 2025 20:41:46 +0200 Subject: [PATCH 5/5] ft: show the schema tab in the Try it Out mode --- test/e2e-cypress/e2e/features/schema-rendering.cy.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/e2e-cypress/e2e/features/schema-rendering.cy.js b/test/e2e-cypress/e2e/features/schema-rendering.cy.js index c2b01f4eeb3..e8f71c9ed52 100644 --- a/test/e2e-cypress/e2e/features/schema-rendering.cy.js +++ b/test/e2e-cypress/e2e/features/schema-rendering.cy.js @@ -6,20 +6,20 @@ describe("OpenAPI 3.0 Schema rendering", () => { .click() .get(".btn.try-out__btn") .click() - .get('.opblock-section-request-body') + .get(".opblock-section-request-body") .within(() => { - cy.contains('button', 'Schema') - .should('exist') - .and('be.visible') + cy.contains("button", "Schema") + .should("exist") + .and("be.visible") .click() cy .get('[data-name="modelPanel"]') - .should('be.visible') + .should("be.visible") cy .get('[data-name="examplePanel"]') - .should('not.exist') + .should("not.exist") }) }) })