Comments (12)
Experimental support for example responses has been added. It features syntax highlighting too (though to be honest, I've only tested that with JSON 😅). It's now available in v0.3.0! Here's what it looks like:
All you have to do is to enclose the example response between <!-- RESPONSE -->
and <!-- ENDRESPONSE -->
tags. This only works with one example. Any other example responses will be ignored.
Any thoughts, ideas, suggestions about this implementation?
(cc @ZarifS @lramosduarte)
from insomnia-documenter.
Yes, you can add as many as you want and you can also specify the status code (see: #16 (comment)).
However, the syntax is going to change in a future release (see #30).
from insomnia-documenter.
@gschier Fair enough! I can see why this wouldn't be ideal, yeah.
@ZarifS I will research into ways to making this workable. Until I can come up with a better solution, a good workaround would be to include the example response in the description of the request.
from insomnia-documenter.
Thanks @jozsefsallai , i ll test this later.
It looks like very interesting
from insomnia-documenter.
Hey! Thank you for the kind words! :)
At the moment, Insomnia export files don't contain the server response, so there isn't really a way to do this (well, apart from running the requests on runtime but that would make the page slow and it will probably not work every time)! Maybe if @gschier can make it so that the response will also be exported, I could make it work with the documenter. 👀
from insomnia-documenter.
Would definitely be possible to implement in Insomnia but I'm not sure that's ideal. It seems like @ZarifS wants to be able to specify an example response manually?
from insomnia-documenter.
Yes exactly! For example showcasing the JSON response that would be expected from doing a call with certain parameters.
Say "/get/users" -> shows a response on the documenter showcasing the response that would be expected like a json body of what the server would send back.
This way anyone looking at the documentation will also known what the response would look like, hence making developing with that API much easier in the case of mocking it for example.
from insomnia-documenter.
I wonder if we could use HTML comments in the request description to designate that it's a response. Then documented could look for those comments and deal with them accordingly
from insomnia-documenter.
Yeah, I was thinking of a similar implementation. 👍
from insomnia-documenter.
Closing for inactivity/tidying up!
from insomnia-documenter.
Is there a way to add multiple response types from one request?
from insomnia-documenter.
from insomnia-documenter.
Related Issues (20)
- Error displaying app HOT 14
- Python request display HOT 1
- cannot access insomnia,json HOT 2
- For support use Discussions, for bug reports use Issues! HOT 4
- Option to not include cookies in documentation
- JSON.parse SyntaxError since 0.4.4 HOT 6
- Environment not working HOT 2
- Error in export Json V4 HOT 1
- Push commit to npm HOT 1
- Documentation show error "TypeError: e is null" HOT 2
- FormatEnv function throws an error when url for some requests are empty
- Add `overflow: auto` to description css class
- Example response not parsed HOT 2
- Github Pages Deployment steps
- Example response not working HOT 13
- Raw content data support. HOT 2
- Converting to Static Site
- Auto Expand Menu HOT 1
- Display info.description
- Demo Page 404 on README.md HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from insomnia-documenter.