Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to reuse RESPONSE in Apiary #358

Closed
zatziky opened this issue Oct 1, 2016 · 4 comments
Closed

How to reuse RESPONSE in Apiary #358

zatziky opened this issue Oct 1, 2016 · 4 comments

Comments

@zatziky
Copy link

zatziky commented Oct 1, 2016

Is there a way how to reuse RESPONSE in Apiary? I think that Data Structures are not the correct way but I can't find anything else...

@w-vi
Copy link
Member

w-vi commented Oct 1, 2016

What do you mean by reusing response? If you want to specify just one response and then refer to it in some of the methods then that is not possible, there is no syntax for it. If you want to reuse the content of response there you can use the Data Structures as you already mentioned.

@zatziky
Copy link
Author

zatziky commented Oct 1, 2016

@w-vi thanks for the answer. I would like to reuse this part:

+ Response 201 (application/json)

    + Body

            {
                "message": {
                    "id": "MESSAGE_ID"
                    "recipient" : {
                        "id": "USER_ID"
                    }
                }
            }

Can you tell if it's possible to reuse it at least partially?

@w-vi
Copy link
Member

w-vi commented Oct 1, 2016

Would something like the following example work for you?

# A

## A [/a]

### Get A [GET]

+ Response 201 (application/json)

    + Attributes (GenericRes)


## B [/b]

### Get B [GET]

+ Response 201 (application/json)

    + Attributes (GenericRes)


# Data Structures

## GenericRes(object)
+ message (object)
    + id : MESSAGE_ID (string) - Message ID
    + recipient(object)
      + id : USER_ID (string)- User ID

@zatziky
Copy link
Author

zatziky commented Oct 2, 2016

Thank you @w-vi , that's exactly what I needed!

@zatziky zatziky closed this as completed Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants