I'm using Apiary to mock out a new API.
I'm trying to avoid having to write out all the JSON responses over and over again. If I do that using a + Attributes(user)
then it will auto generate a bunch of attributes blocks in the machine panel, which is super confusing in my mind (especially when you have multiple responses).
The resulting documentation looks way better if you write out the JSON request/response blocks manually.
Is there a way to store Request/Response objects as a Data Structure? Maybe a Model perhaps?
I'd love to be able to do something like this:
## Users [/auth]
A user object contains the these attributes.
+ Attributes (user) <!-- I like this here -->
### Refresh a token for a user [POST /auth/refresh]
+ Request (application/json)
+ Headers
Authorization: Bearer jsonWebToken
+ Response 200 (application/json)
+ Body
{
"data": [
(user) <!-- I wish this was the user data structure as JSON -->
],
"meta": {
"access_token": "jsonWebToken",
"token_type": "Bearer",
"expires_in": 3600
}
}
# Data Structures
## user (object)
+ id: 123 (number)
+ email: drew@funkhaus.us
Note: The user
object is 30 attributes long in real life.