0

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.

Drew Baker
  • 14,154
  • 15
  • 58
  • 97

1 Answers1

0

Unfortunately that's not a supported scenario, you can't but data structures into your JSON payloads.

So if I understand correctly - using Attributes is fine but you would like hide them in documentation. Could you confirm that?

Vincenzo
  • 1,549
  • 1
  • 9
  • 17
  • Yes I would be OK with using Attributes, as long as it didn't generate the blocks in the machine panel (the one on the far right in blue). – Drew Baker Sep 18 '16 at 05:44
  • You might want to open an issue in Apiary itself then. Just connect to the website with your account and use the internal chat to file an issue - we'll try to take care of it. – Vincenzo Sep 18 '16 at 08:16