github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/jackson_annotations.mustache (about) 1 {{! 2 If this is map and items are nullable, make sure that nulls are included. 3 To determine what JsonInclude.Include method to use, consider the following: 4 * If the field is required, always include it, even if it is null. 5 * Else use custom behaviour, IOW use whatever is defined on the object mapper 6 }} 7 @JsonProperty(JSON_PROPERTY_{{nameInSnakeCase}}) 8 @JsonInclude({{#isMap}}{{#items.isNullable}}content = JsonInclude.Include.ALWAYS, {{/items.isNullable}}{{/isMap}}value = JsonInclude.Include.{{#required}}ALWAYS{{/required}}{{^required}}USE_DEFAULTS{{/required}}) 9 {{#withXml}} 10 {{^isContainer}} 11 @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") 12 {{/isContainer}} 13 {{#isContainer}} 14 {{#isXmlWrapped}} 15 // items.xmlName={{items.xmlName}} 16 @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") 17 {{/isXmlWrapped}} 18 {{/isContainer}} 19 {{/withXml}}