apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.65k stars 2.14k forks source link

I can't find a way in API Blueprint to have variables as MSON objects so I don't have to repeat objects for paginated data in each Entity. #449

Closed Montana closed 4 years ago

Montana commented 5 years ago

Montana here, so my current MSON is this:

+ Response 200 (application/json)
    + Attributes
        - data (array[Customer])
        - links (Links)
        - meta (Meta)

## Links (object)
+ first: `https://demo.url.com/customers?page=1`,
+ last: `https://demo.url.com/customers?page=4`,
+ prev: `null`,
+ next: `https://demo.url.com/customers?page=2`

## Meta (object)
+ current_page: 1,
+ from: `1`,
+ last_page: `4`,
+ path: `https://demo.url.com/customers`,
+ per_page: `25`,
+ to: `25`,
+ total: `89`

This works well for the Customer entity, but if I have let's say an Invoice Entity, I'll have the "customer" keyword in the url's if I do that.

+ Response 200 (application/json)
    + Attributes
        - data (array[Invoice])
        - links (Links)
        - meta (Meta)

Any idea how to dynamically set a variable and if this is even possible?