Skip to content
Ryan Heaton edited this page Jun 20, 2024 · 12 revisions

Jackson Module

The Jackson module processes all the Java data types that can be (de)serialized to/from XML using Jackson 2. The Jackson module creates the model that is used to generate all the JSON-based documentation for the API.

Configuration

The configuration for the Jackson module is specified by the jackson element under the modules element in the Enunciate configuration file. The following attributes are supported on the jackson element:

attribute description
honorJaxb Jackson has support for JAXB annotations. This attribute dictates whether JAXB annotations will be honored when modeling the JSON data types. By default, JAXB annotations will be honored only if the Jackson JAXB support classes are found on the classpath.
dateFormat The default format of the dates. By default, dates are assumed to be serialized using whole numbers. Requires Enunciate 2.3+.
datatype-detection The "datatype-detection" dictates how the module is to detect data types for the API. The valid values are "passive" (data types will only be detected when other modules and services explicitly depend on the data types), "aggressive" (data types will be detected aggressively, by scanning the entire classpath), and "local" (data types will be detected only from among those in the source code of the current invocation context). Default is "passive".
collapse-type-hierarchy (Since 2.4) Whether to collapse the type hierarchy for JSON data types, removing the concept of supertypes from the generated documentation. By default, Enunciate will document JSON data type hierarchies.
disableExamples (Since 2.7) Whether to disable examples in the generated documentation. Default: false.
wrapRootValue (Since 2.9) Whether to wrap JSON examples with the Jackson "root value". Refer to the Jackson serialization config for more details. Default: false.
propertyNamingStrategy (Since 2.11) The alternate naming strategy to use for json properties. One of "CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES", "PASCAL_CASE_TO_CAMEL_CASE", "LOWER_CASE".
propertiesAlphabetical (Since 2.11) Whether to sort JSON properties alphabetically. Default: false
beanValidationGroups (Since 2.13) Java bean validation groups.

Elements

The jackson element supports the following child elements:

mixin

The "mixin" subelement of the "jackson" element is used to declare Jackson mixin annotation classes. These "mixin" elements support the following attributes:

  • The "target" attribute specifies the target class for the mixin.
  • The "source" attribute specifies the mixin source that carries the annotations to be mixed in.

accessor-visibility

(As of Enunciate 2.10)

The "accessor-visibility" subelement of the "jackson" element is used to declare Jackson default accessor visibility. These "accessor-visibility" elements support the following attributes:

  • The "type" attribute specifies the type of the accessor ("getter", "setter", "creator", "field", "is_getter", "all")
  • The "visibility" attribute specifies the default visibility ("any", "non_private", "protected_and_public", "public_only", "none", "default")

examples

(As of 2.10.)

The "examples" subelement of the "jackson" element is used to declare external documentation examples. Child "example" elements support the following attributes:

  • The "type" attribute specifies documentation type for which to provide an example.
  • The "example" attribute specifies the text of the documentation example.

type-format

(As of 2.18.)

The "type-format" subelement of the "jackson" element is used to declare JSON type formats of specific classes. These "type-format" elements support the following attributes:

  • The "class" attribute specifies the fully-qualified class name of the class.
  • The "format" attribute specifies JSON format of the class.
Clone this wiki locally