Skip to content

[BUG] [Java] XmlMapper.configure removed in Jackson 3 is still used #23860

@kk-mats

Description

@kk-mats

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Java restclient generator with withXml and useJackson3 uses XmlMapper.configure which was removed in Jackson 3.

openapi-generator version

7.22

OpenAPI declaration file content or url

any

Generation Details

I use maven plugin.

<plugin>
				<groupId>org.openapitools</groupId>
				<artifactId>openapi-generator-maven-plugin</artifactId>
					<execution>
						<id>client</id>
						<goals>
							<goal>generate</goal>
						</goals>
						<configuration>
							<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
							<generatorName>java</generatorName>
							<withXml>true</withXml>
							<configOptions>
								<library>restclient</library>
								<useJackson3>true</useJackson3>
								<useSpringBoot4>true</useSpringBoot4>
							</configOptions>
						</configuration>
					</execution>
				</executions>
			</plugin>
Steps to reproduce
  1. mvn compile fails due to compile error due to use of XmlMapper.configure.
Related issues/PRs
Suggest a fix

xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true);

Like JsonMapper, XmlMapper.builder() should be used to get configured XmlMapper when useJackson3 is enabled.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions