apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.63k stars 2.14k forks source link

How render/display information that some attributte can be null? #366

Closed webmato closed 7 years ago

webmato commented 7 years ago

The issue how do document null value of some attribute we have solved.

- myAtrribute (object, nullable, required) - 'Lorem ipsum'

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 be null and I don't think that description field is a solution.

I have tried this but it generates error:

- myAtrribute: null (object, nullable, required) - 'Lorem ipsum'

this generates semantic error: 'object' with value definition. You should use type definition without value eg. '- key (object)'

w-vi commented 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.

webmato commented 7 years ago

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. vystrizek

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.

w-vi commented 7 years ago

I see what you mean now. Thanks for reporting it.

kylef commented 7 years ago

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.

webmato commented 7 years ago

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