Referencing a property inside a defined data structure in API Blueprint/MSON

227 views Asked by At

I've been working with the API Blueprint format for designing an API and have had a lot of fun working with it. When I was declaring my data structures I came upon a code reuse or model reuse issue.

According to the documentation when declaring a Response it has to be done like this:

For example:

+ Request 200 (application/json)

However when multiple people work on the document I don't want to instruct them what return code to use since we have them defined and they're numbers so people forget them. So to avoid having to go back and forth, instead I made this with the idea that I can use/reference one of the properties:

# Data Structures

## HttpCode (object)
+ success: 200 - Request processed successfully
+ not_found: 404 - Content requested not found
+ forbidden: 403 - Access to content is forbidden

I would reference it as such:

+ Response (HttpCode.success) (application/json)
...

It obviously does not work and I cannot find anything that pertains to what I want to do in the docs. Maybe i've missed it.

So how do you do it? Is it possible?

Thanks!

1

There are 1 answers

0
Arnold Balliu On

This is not possible. Their representative in GitHub closed my issue. https://github.com/apiaryio/api-blueprint/issues/411