insomnia
insomnia copied to clipboard
[Feature request] Auto-Generate XML Request Bodies from OpenAPI spec and prevent deletion of manually edited ones
Question
- How does one get Insomnia to auto-generate XML Request Bodies?
- How does one get Insomnia to not delete manually created XML Request Bodies if auto-generate doesn't work or isn't desired?
In contrast to requestBody.content.application/json
(which does auto-generate Request Body), when using requestBody.content.application/xml
Insomnia Designer is NOT auto-generating a Request Body as implied in documentation here. And it's deleting any manually created Request Body after navigating to the Design
tab.
It appears that some code or plugin to auto-generate XML is missing and that the refresh / re-generate request body logic operates without awareness that there is nothing that is going to auto-generate a new Request Body for XML.
Context
I'm trying to create test cases for XML APIs. I find that I can do that only by manually creating a Request Body. However once doing so, Insomnia will delete the manually created Request Body after the Design
Tab is clicked. This makes Insomnia almost usuable for testing.
The sequence to see the XML Request Body deleted is strange (has a couple extra steps) because Insomnia has a wider issue (also occurs after a Git Update) with not automatically refreshing screens immediately when a change happens.
To recreate:
- Click
Design
. Create or access OpenAPI Spec withrequestBody.content.application/xml
- Click
Debug
. SelectXML
. See nothing auto-generated - Enter XML Request Body. Optionally Send. Optionally Generate Tests and Execute. Optionally click back and forth between
Debug
andTest
. Optionally restart Insomnia. See XML Request Body saved in all cases. - Click
Design
. Make no changes. ClickDebug
. ClickDesign
orTest
. ClickDebug
. See XML Request Body deleted.
NOTE: Recreate requires navigating back and forth to the Debug tab more than once due to an "Out-of-synch Refresh" problem. (ie: you must do Step 4 above)
System Environment: recreate_00_SystemEnvironment-About.txt
Example OpenAPI Spec: recreate_01_openAPI-Spec.txt
application/json rendering in Live Preview:
application/json Auto-Generating Request Body:
application/xml rendering in Live Preview:
application/xml Failing to Auto-Generate Request Body:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi @waciii-ra thanks for reporting this!
I've gone ahead and marked this as a feature request/improvement, and internally added it to our list of improvements. We'll update you here if there's any changes.
Also giving a heads up to @wdawson - we may want to revisit if this is something we want to do regardless of JSON/XML or other body types, and fetch the information (if available) that is in the specs and put it as suggested request body always.
In the meantime @waciii-ra feel free to report any other issues you come across!
It took me a lot of headscratching and searching to find this. It should be documented somewhere or visible in the UI that XML generation does not work.
For me the experience was that importing just stopped working, only later releasing that the difference was XML instead of JSON.
It is in no way obvious why it doesn't work as the preview indeed shows the correct example message, and the linting does not show any warnings either.
If it is not supported, it should be obvious and documented.