Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't double encode application/json requestBody examples #1100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

@iain-smartretail
Copy link
Contributor

@iain-smartretail iain-smartretail commented Mar 5, 2025

Description

When providing examples of application/json request body content, docusaurus-theme-openapi-docs will double escape the content for display and for use in code samples.

Motivation and Context

This pull request introduces changes to correctly render request body examples. This brings request body examples inline with response body examples which are already rendered correctly.

How Has This Been Tested?

Minimal example

openapi: 3.0.3
info:
 title: Minimal Example
 version: 1.0.0
servers:
 - url: http://example.com
paths:
 /demo:
 post:
 summary: Demo Endpoint
 description: Demo incorrect request body rendering
 requestBody: 
 content:
 application/json:
 schema: 
 type: object
 properties:
 test:
 type: string
 example: alpha
 examples:
 bravo:
 summary: Bravo
 value: |
 {
 "test": "bravo"
 }
 responses:
 '200':
 description: OK
 content:
 application/json:
 schema: 
 type: object
 properties: 
 success:
 type: boolean
 examples:
 ok:
 summary: OK
 value: |
 {
 "success": true
 }

Screenshots (if appropriate)

Before pull request:
image

After pull request:
image

Types of changes

Bug fix (non-breaking change which fixes an issue)

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.

Copy link

github-actions bot commented Mar 7, 2025

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

https://docusaurus-openapi-36b86--pr1100-agjufohh.web.app

(expires 2025年4月06日 21:11:27 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@blindaa121 blindaa121 merged commit d7c18c9 into PaloAltoNetworks:main Mar 7, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /