OpenAPITools/openapi-generator · error · IllegalArgumentException
useJackson3 with jvm-spring-restclient requires useSpringBoo
Error message
useJackson3 with jvm-spring-restclient requires useSpringBoot4=true.
What it means
Even on jvm-spring-restclient, Jackson 3 support is gated on Spring Boot 4: the tools.jackson artifacts line up with Boot 4's dependency set, so the guard requires the separate boolean useSpringBoot4 to be true. useSpringBoot3=true does NOT satisfy it — the check reads the useSpringBoot4 field directly, and useJackson3 does not imply it.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java:504
setSerializationLibrary((String) additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));
additionalProperties.put(this.serializationLibrary.name(), true);
} else {
additionalProperties.put(this.serializationLibrary.name(), true);
}
if (isUseJackson3()) {
if (this.serializationLibrary != SERIALIZATION_LIBRARY_TYPE.jackson) {
throw new IllegalArgumentException("useJackson3 requires serializationLibrary=jackson");
}
if (additionalProperties.containsKey("openApiNullable")
&& Boolean.parseBoolean(additionalProperties.get("openApiNullable").toString())) {
throw new IllegalArgumentException("openApiNullable cannot be set with useJackson3");
}
if (!JVM_OKHTTP4.equals(getLibrary()) && !JVM_SPRING_RESTCLIENT.equals(getLibrary())) {
throw new IllegalArgumentException("useJackson3 is only supported for the jvm-okhttp4 and jvm-spring-restclient libraries at this time.");
}
if (JVM_SPRING_RESTCLIENT.equals(getLibrary()) && !useSpringBoot4) {
throw new IllegalArgumentException("useJackson3 with jvm-spring-restclient requires useSpringBoot4=true.");
}
}
if (additionalProperties.containsKey(MAP_FILE_BINARY_TO_BYTE_ARRAY)) {
setMapFileBinaryToByteArray(convertPropertyToBooleanAndWriteBack(MAP_FILE_BINARY_TO_BYTE_ARRAY));
}
additionalProperties.put(MAP_FILE_BINARY_TO_BYTE_ARRAY, mapFileBinaryToByteArray);
if (mapFileBinaryToByteArray) {
typeMapping.put("file", "kotlin.ByteArray");
typeMapping.put("binary", "kotlin.ByteArray");
}
if (additionalProperties.containsKey(GENERATE_ONEOF_ANYOF_WRAPPERS)) {
setGenerateOneOfAnyOfWrappers(convertPropertyToBooleanAndWriteBack(GENERATE_ONEOF_ANYOF_WRAPPERS));
}
if (additionalProperties.containsKey(FAIL_ON_UNKNOWN_PROPERTIES)) {
setFailOnUnknownProperties(convertPropertyToBooleanAndWriteBack(FAIL_ON_UNKNOWN_PROPERTIES));View on GitHub (pinned to fcec517be3)
Solutions
- Add `useSpringBoot4=true` alongside useJackson3 on jvm-spring-restclient.
- If the project is still on Boot 3, drop useJackson3 and stay on Jackson 2 — the combination is unsupported by design.
Example fix
# before openapi-generator-cli generate -g kotlin --library=jvm-spring-restclient -i api.yaml -p useJackson3=true,useSpringBoot3=true # after openapi-generator-cli generate -g kotlin --library=jvm-spring-restclient -i api.yaml -p useJackson3=true,useSpringBoot4=true
Defensive patterns
Strategy: validation
Validate before calling
# shell: useJackson3 on spring-restclient needs Boot 4 explicitly if [ "$USE_JACKSON_3" = "true" ] && [ "$LIBRARY" = "jvm-spring-restclient" ] && [ "$USE_SPRING_BOOT4" != "true" ]; then echo "useJackson3 with jvm-spring-restclient requires useSpringBoot4=true" >&2; exit 2 fi
Try / catch
try {
DefaultGenerator().opts(clientOptInput).generate()
} catch (e: IllegalArgumentException) {
throw IllegalStateException("useJackson3 needs useSpringBoot4=true on jvm-spring-restclient: ${e.message}", e)
} Prevention
- Pass useSpringBoot4=true (not useSpringBoot3) when enabling useJackson3.
- Do not assume flags imply each other — boot version and Jackson version are independent booleans.
- During Boot 3→4 migrations, update generator flags in the same commit.
When it happens
Trigger: `--library=jvm-spring-restclient -p useJackson3=true,useSpringBoot3=true` (Boot 3 only, no boot4 flag) → throws; also `useSpringBoot4` omitted entirely while useJackson3=true.
Common situations: Projects mid-migration that enable Boot 3 flags plus Jackson 3; assuming the newest serialization flag pulls in the newest Boot flag automatically.
Related errors
- useJackson3 requires serializationLibrary=jackson
- openApiNullable cannot be set with useJackson3
- useJackson3 is only supported for the jvm-okhttp4 and jvm-sp
- This library requires Spring Boot 3 or 4. Try adding '--addi
- useJackson3 is only supported for the 'native', 'apache-http
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/8ec670d767221fc5.
Report an issue: GitHub.