-
Notifications
You must be signed in to change notification settings - Fork 180
Expressing arrays of a fixed (non-inherited) type #66
Comments
I was thinking about it a bit and if we for need to keep the original |
There was a suggestion of |
I agree with @w-vi tho I ponder about clarity and proper keyword name. Most descriptive would be |
If I was to choose one of the @z proposals I would go for |
|
I have found such enum https://github.com/apiaryio/snowcrash/blob/master/src/MSON.h#L135 |
That's why I came up with |
|
@pksunkara I've implemented parsing of |
Also, we need to add some text to the MSON Specification regarding this. |
Ok, I'll try |
Shall this still be open, when we are actually supporting this? |
Nope. Closing this. |
In MSON, it's not possible to express arrays which MUST contain a certain type of element. But the contents of the array does not have fixed values.
For example, I might want to describe a data structure which is an array of User objects. Where the array SHOULD only contain User objects, and other types of items inside the array are not valid.
In JSON Schema, I can represent this as follows:
Where I have a JSON Structure as follows, which validates using the previous schema:
However, a user without a username wouldn't validate:
It should be possible to express what I have outlined above in API Blueprint / MSON. For example, I may intend to describe an array of User with the following blueprint:
However, given the MSON specification
array[User]
does not mean an array of only User. But instead, an array which MAY contain User which ultimately means generated JSON Schema's cannot say that the array MUST contain ONLY User.The text was updated successfully, but these errors were encountered: