drafter
drafter copied to clipboard
JSON Visitor should use `sample` value for rendering JSON in array
For example, if I want to reference another data structure inside an array of fixed-type. I'd like to provide multiple examples to be rendered in the JSON array example.
# API
## GET /users
+ Response 200 (application/json)
+ Attributes
+ users (array[User], fixed-type)
+ Sample
+ (User)
+ username: doe
+ (User)
+ username: tim
## Data Structures
### User
+ username: kyle
The Sample
section is ignored when it comes to rendering a JSON body and I think the sample should be included.
Current Behaviour
{
"users": [
{
"username": "kyle"
}
]
}
Expected Behaviour
{
"users": [
{
"username": "doe"
},
{
"username": "tim"
}
]
}
The same problem exists for objects as well as array.
Another case to reproduce:
+ Response 200 (application/json)
+ Attributes
+ location (array, fixed)
+ `43.3` (number, sample)
+ `-8.41` (number, sample)