Skip to content

feat: Add schema tab in Request and Response - #1164

Closed
dsuket wants to merge 10 commits into
PaloAltoNetworks:mainfrom
dsuket:add-schema-tab-in-request
Closed

dsuket wants to merge 10 commits into
PaloAltoNetworks:mainfrom
dsuket:add-schema-tab-in-request

Conversation

@dsuket

@dsuket dsuket commented Jun 11, 2025 •

Copy link
Copy Markdown
Contributor

Description

Ensure that examples are displayed correctly when there are examples in the Media Type and Schema in the Request body and Response.

Motivation and Context

To address Issue #1158, I need to organize the example-related parts.
This is the 3rd step toward that goal.

Please see below first.

How Has This Been Tested?

  • Pass npm run build
  • Pass npm run test
  • I went through the demo API and tests and confirmed that the examples are being displayed properly.

Screenshots (if appropriate)

example of schema in requestBody
スクリーンショット 2025-06-11 18 36 50
スクリーンショット 2025-06-11 18 36 55

examples of schema in requestBody
スクリーンショット 2025-06-11 18 37 00
スクリーンショット 2025-06-11 18 37 06

example of schema in response
スクリーンショット 2025-06-11 18 37 35
スクリーンショット 2025-06-11 18 37 41

examples of schema in response
スクリーンショット 2025-06-11 18 37 47
スクリーンショット 2025-06-11 18 37 52

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@github-actions

github-actions Bot commented Jun 11, 2025 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 8ec03dc):

https://docusaurus-openapi-36b86--pr1164-kv9npimt.web.app

(expires Sat, 26 Jul 2025 17:23:49 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@dsuket dsuket mentioned this pull request Jun 12, 2025
4 tasks done
@dsuket dsuket changed the title Add schema tab in Request and Response feat: Add schema tab in Request and Response Jun 13, 2025
@sserrata

Copy link
Copy Markdown
Member

Hi @dsuket, I'm not opposed to exposing request samples/example schemas, but I do wonder if it duplicates the samples we already include in the "API Explorer" panel. I also wonder about the UX noise it may introduce, especially without a direct way to enable/disable the samples. Interested in your thoughts here.

@sserrata sserrata self-assigned this Jun 27, 2025
@sserrata sserrata added the reviewing 👀 Undergoing manual audit to determine if issue should still be active label Jun 27, 2025
@dsuket

dsuket commented Jul 2, 2025

Copy link
Copy Markdown
Contributor Author

@sserrata Sorry for the late reply.
Is what you refer to as the "API Explorer" panel the REQUEST panel in the bottom right?
before-2

If so, then it is indeed displayed correctly for Media type examples.

However, for schema examples, it is not displayed correctly as shown below.
before-3

Therefore, I made it display in tabs for the Request, similar to the Response, as shown below.
after

Additionally, I believe that having the Request and Response displayed consistently makes it easier to recognize. In fact, I didn't notice the REQUEST panel in the bottom right until you pointed it out. 😅

sserrata added a commit that referenced this pull request Dec 19, 2025
Adds support for the OpenAPI 3.1 schema.examples array in the API Explorer
Body component. This is different from Media Type examples (which is an
object with named examples) - schema.examples is an array of example values
as per JSON Schema alignment in OAS 3.1.

- Handle schema.examples for JSON content types
- Handle schema.examples for XML content types
- Add test cases for schema.examples

Closes #1164 (alternative implementation)
omonk pushed a commit to omonk/docusaurus-openapi-docs that referenced this pull request Dec 23, 2025
…Networks#1269)

Adds support for the OpenAPI 3.1 schema.examples array in the API Explorer
Body component. This is different from Media Type examples (which is an
object with named examples) - schema.examples is an array of example values
as per JSON Schema alignment in OAS 3.1.

- Handle schema.examples for JSON content types
- Handle schema.examples for XML content types
- Add test cases for schema.examples

Closes PaloAltoNetworks#1164 (alternative implementation)

This branch had an error being deployed

1 failed deployment
default — 4ac7c38f Deployed Jul 2, 2025 by dsuket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reviewing 👀 Undergoing manual audit to determine if issue should still be active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants