Closed garytaylor closed 7 years ago
You can use fixed-type
if you want to specify and array of something.
https://github.com/apiaryio/mson/blob/master/MSON%20Specification.md#353-type-attribute
Example, Array of Note(s):
https://github.com/apiaryio/mson/blob/master/examples/api-blueprint.md
Hope that it solves your problem.
That has solved it - thank you @w-vi
Gary
Whist this problem originally showed up in drafter, the same can be seen in drafter.js or the apiary web service.
Given the following api blueprint document
(which is taken from the api blueprint example 10 - but simplified to demonstrate the issue without distractions.)
The "tags" attribute - which is specified as an array - is output as an array in the json-schema, but the inner details are lost - so it is effectively an array of anything.
See the data below - which is taken straight from the apiary service web site - using "SHOW JSON SCHEMA" in the response.
It can be seen that "tags" is valid if it is an array - it doesn't specify the types that are valid in the array or anything.
The same applies even if I use something simple like
This doesnt seem to be anything silly that I am doing wrong - ive even tried it with example 10 from the api blueprint repo - without editing it - and we get the same thing for the endpoint for the list of coupons.
This is literally a show stopper for us using API Blueprint as we cannot validate against it reliably and the project I am working on is an rspec matcher to allow us to do exactly that - so that our documentation is always the source of truth - for our customers and our internal tests. According to the MSON specifications, this is supposed to work, but it is not doing so for me at the moment.
Please can someone help ?
Thanks
Gary