Description
Hi,
Let's say we have a field description like this:
fieldWithPath("foo")
.type(JsonFieldType.STRING)
.description("some description")
If the returned value is "foo": null
, then an exception is being thrown because null is not considered a STRING.
In such cases, we can mark the field as .optional()
, signalling that a String may be provided, but can also be null.
The problem I noticed is that .ignored()
also gets rid of this exception. IMHO that shouldn't happen, because the returned value (null) still violates the field description. In other words: the value is still optional, and hiding it from the docs does not change that fact.
In short, for a nullable field "foo", which should not be included in the docs, I'd expect this syntax:
fieldWithPath("foo")
.ignored()
.optional()
.type(JsonFieldType.STRING)
.description("some description")
Of course all of the above is a matter of how we interpret what it means for a description to be ignored.
If the above is expected behavior, maybe it would make sense to split "hiding from docs" and "ignoring type" into separate fields, so we can do this fieldWithPath("foo").hide().optional()
(hide, but still validate) ?