Previously, the ordering was:
1. Operation snippets
2. Default snippets
3. Additional snippets
This meant that any operation snippets (those specifically configured
for the documentation of the particular operation) would be
overwritten by the output of the default snippets.
This commit updates the ordering to the following:
1. Default snippets
2. Operation snippets
3. Additional snippets
Closes gh-453
Asciidoctor appears to apply two blanks lines beneath a code block
at the end of an included file otherwise the section heading that
opens the following included file will be omitted.
Closes gh-442
Previously, StandardWriterResolver only replaced placeholders in the
operation name. This meant that the name and location of generated
snippets was unnecessarily limited.
This commit makes things more flexible by updating
StandardWriterResolver to replace placeholders in the snippet name
as well.
Closes gh-403
Previously, if a field nested beneath an optional field was documented
and was required, it would be identified as missing even if its
optional ancestor was missing. This made it impossible to document
required fields of an optional subsection of a payload.
This commit updates JsonContentHandler to consider a field’s ancestors
when determining if it should be reported as missing. If the field
field has an optional ancestor that is not present, the field is not
considered to be missing if it too is not present. If the field has
an optional ancestor that is present then the field is considered to
be missing if it is not present.
Closes gh-429
Previously, if an array contained objects where a field was sometimes
null and sometimes had a value of a consistent type, the type inferred
type was varies. Furthermore, it was not possible for the user to
specify a type other than varies as a mismatch would be detected.
This commit updates JsonFieldTypeResolver so that, when dealing with
an imprecise field path (i.e. a path for a field within an array),
null values that don't match the common type for the field are
ignored. This produces the following behavior when nulls are involved:
- All null fields results in the null type
- A mixture of nulls and a particular type results in the particular
type
- A mixture of nulls and two or more other types results in the varies
type
Closes gh-398
Previously, the included .adoc files did not consistently end with a
blank line. In certain cases, Asciidoctor requires a blank line before a
new section. As a result, the lack of blank lines meant that some
section headings did not appear correctly.
This commit updates each of the included .adoc files in the
documentation to ensure that each ends with a blank line.
Previously, when the operation block macro rendered the fragment
for a snippet, every top-level block in the fragment had its parent
set. Setting the parent has the side-effect of also setting the
block's document to be that of its parent. This meant that every
top-level block's document referred to the main document, but any
descendents were left with their document referring to the fragment
document. This did not cause a problem with the HTML backend (which
does not consider a block's document) but the PDF backend does
consider a block's document resulting in the descendents being
omitted from the generated PDF.
This commit updates the operation block macro to set the parent of
every block in the fragment to its correct value. This has the
side-effect of causing the block to update its document reference to
point to the main document.
Closes gh-396
Previously, the document fields in an XML payload, the request or
response had to have an application/xml content type. This prevented
documenting standard XML content types such as text/xml and
application/rss+xml as well as payloads with custom XML content types.
This commit updates the logic that sets up the ContentHandler to
first attempt to parse the content as JSON. If that fails it then
parses it as XML. If that fails an exception is thrown. This allows
any JSON or XML content, irrespective of the actual content type, to
be documented.
Closes gh-393