Closed webmato closed 7 years ago
Your - myAtrribute (object, nullable, required) - 'Lorem ipsum'
should suffice, if you don't provide an example value the null
value will be used in the example JSON body. If that is what you are asking for.
Yes for passing tests it is enough, but a person who just reading this documentation does have no idea that this attribute can be null
. Many times I had to explain to my customers or colleague that some particular attribute can be null
- they always expect some real value not null
.
See this my of Apiary example.
The issue is that many people just expect they will always receive:
myAtrribute: {
name: 'myCoolName',
success: true,
}
...and if they get...
myAtrribute: null
...they reports it as an error.
In the rendered documentation should be some info that some attribute can be null
.
I see what you mean now. Thanks for reporting it.
Apiary lists what is shown in rendered documentation from MSON at https://github.com/apiaryio/attributes-kit/blob/master/STATUS.md#35-type-definition and you can see that nullable is not supported yet.
ok 👍 good to know. Apairy/Apiblueprint is huge project with so many pieces, repositories and tools, it is sometimes hard to find relevant info 😄 Thanks
The issue how do document
null
value of some attribute we have solved.But I see another issue - how this
nullable
attribute is (not) rendered in Apiary. The reader of this documentation does not have any information that this attribute can benull
and I don't think that description field is a solution.I have tried this but it generates error:
this generates semantic error:
'object' with value definition. You should use type definition without value eg. '- key (object)'