-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Ability to reference repeated data #236
Comments
I think you are looking for MSON with which you can do the above. |
MSON could potentially help, but I don't want to use MSON in this particular situation :) Although that being said, it's unclear how MSON would have actually helped, so any links would be appreciated |
I don't know why you do not want to use MSON, but MSON was designed exactly with this use case in mind. Could you explain more? |
@foxx Just to be clear, @pksunkara is proposing you do something like follows. Where you are defining reusable components you can use in multiple different resources/actions. ## Say hello [POST /say/hello]
+ Response 400 (application/json)
+ Attributes (Errors)
## Data Structures
### Errors
+ errors (array[Error])
### Error
+ message: some error
+ code: 1 (number) Which would get expanded into the following JSON example in Apiary: |
Oh interesting, actually yes you're quite right this would solve the issue. I couldn't see any mentioning of this in the examples or documentation, at least not clearly, did I miss something? |
There are a few examples in the example folder such as, Attributes, Advanced Attributes and Data Structures |
Thanks for the quick reply and additional info, appreciated |
Imagine the following scenario;
Lets assume that 4xx response will always contain the same data structure for all API endpoints. Rather than having to repeat this data structure definition multiple times, it would be useful to define it once in the document and then reference to it. Models do not work for this, because they require that you define a path, which doesn't really make much sense (as a data structure is independent of its resource path, right?).
I've had a read through some other issues which feel related, including #29, #25, #9 and #19, but none of them seem to provide any solution or firm outcome.
Could someone please clarify the correct way of achieving the above goal?
The text was updated successfully, but these errors were encountered: