fix(sample-gen): should return json literal example #6827
Merged
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.

Description
The sample gen should, in case of json media type and string literal example, try to parse the example. If it can not parse the example like the xml example shown in issue(for media type json) it will return it like it is a json string example.
In case it is parable it will return the json. This will result in rendering the json string literal examples as expected.
Motivation and Context
Fixes #6595
How Has This Been Tested?
Have taken care to ensure that literals are generated as json.
Screenshots (if appropriate):
https://editor.swagger.io/?url=https://gist.githubusercontent.com/mathis-m/20bf8fb2deabd2a5a0821418aa4adacc/raw/df18fb826d8fac8a648250dfa4e9050672992cbf/Zs2qqBv9YU.txt
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests