Description
Currently, I document a valid sample request using the HTTP request body snippet.
But, I often find myself writing manual ASCIIDOC tables in the documentation prior to a sample request/response that documents:
- the JSON property names
- The JSON type (string, integer, boolean)
- The associated validation rules, e.g. not null, length <200 chars, must match pattern xyz. - I'm still not quite sure how Bean Validation API support #42 works - I need to brush up on my reading of the docs related to this feature
When the developer reads the docs of the sample http request it's very useful to see one example of a valid payload. it should help to answer "what are the property names" and "what are the data types". But this might not always be so clear, e.g. if the sample request sends 5
, does the endpoint allow floating point numbers 5.0
? Are there any fields which were missing from the request because perhaps they were null
and the Jackson serialiser is configured to not send null
values (arguably a bad test)?
To solve the first and second problem, is there any potential for a module which would use some sort of jackson introspection to discover all the object graph properties and their associates type (mapped to JSON data types) .
Obviously my current manual tables need to be maintained by hand and are cumbersome/error prone.