fix: Add case to handle x-examples value of body param. #10371
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow populating
body
with default values described inx-examples
Description
Changes done here are to allow the use of
x-examples
inside a (body
)parameter
in order to populate it with default values.Motivation and Context
Fixes: #3233
How Has This Been Tested?
Manually.
Attempts were made to write unit tests, but I could not get the code (
test\unit\components\parameter-row.jsx
) to render deep enough in order to get the text of thecode
element.The change in the Api declaration I used to test looks like this (can be compared with screenshots bellow).
This is the
parameters
declaration on thePOST /pet
method I used to test.Screenshots (if appropriate):
The above changed declaration resulted in the following:

Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests
Attempts to add
unit
tests were unsuccessful because I could not get the whole DOM subtree to render.Last thing it gave me was a
div
with with objects passed asattributes
to it. If you have an idea how this can be tested or know of tests I could use as example just point it out to me and Im see if I can introduce tests.