OpenAPITools/openapi-generator · error · RuntimeException
This library requires Spring Boot 3 or 4. Try adding '--addi
Error message
This library requires Spring Boot 3 or 4. Try adding '--additional-properties useSpringBoot3=true' or '--additional-properties useSpringBoot4=true' to your command.
What it means
processJvmSpringRestClientLibrary requires an explicit Spring Boot baseline for the jvm-spring-restclient library: the guard checks additionalProperties for useSpringBoot3 or useSpringBoot4 via getOrDefault(...,false).equals(false), so if both are absent (or both false) it throws. Spring Boot 2 or unspecified baselines are not supported for the RestClient template.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java:893
throw new RuntimeException("This library currently only supports jackson serialization. Try adding '--additional-properties serializationLibrary=jackson' to your command.");
}
commonJvmMultiplatformSupportingFiles(infrastructureFolder);
addSupportingSerializerAdapters(infrastructureFolder);
additionalProperties.put(JVM_SPRING, true);
additionalProperties.put(JVM, true);
}
private void processJvmSpringWebClientLibrary(final String infrastructureFolder) {
processJvmSpring(infrastructureFolder);
additionalProperties.put(JVM_SPRING_WEBCLIENT, true);
}
private void processJvmSpringRestClientLibrary(final String infrastructureFolder) {
if (additionalProperties.getOrDefault(USE_SPRING_BOOT3, false).equals(false)
&& additionalProperties.getOrDefault(USE_SPRING_BOOT4, false).equals(false)) {
throw new RuntimeException("This library requires Spring Boot 3 or 4. Try adding '--additional-properties useSpringBoot3=true' or '--additional-properties useSpringBoot4=true' to your command.");
}
processJvmSpring(infrastructureFolder);
additionalProperties.put(JVM_SPRING_RESTCLIENT, true);
}
private void processMultiplatformLibrary(final String infrastructureFolder) {
commonJvmMultiplatformSupportingFiles(infrastructureFolder);
additionalProperties.put(MULTIPLATFORM, true);
if (!DateLibrary.STRING.value.equals(dateLibrary) && !DateLibrary.KOTLINX_DATETIME.value.equals(dateLibrary)) {
throw new RuntimeException("Multiplatform only supports string and kotlinx-datetime. Try adding '--additional-properties dateLibrary=kotlinx-datetime' to your command.");
}
setRequestDateConverter(RequestDateConverter.TO_STRING.value);
// multiplatform default includes
defaultIncludes.add("io.ktor.client.request.forms.InputProvider");View on GitHub (pinned to fcec517be3)
Solutions
- Add `-p useSpringBoot3=true` (Boot 3 baseline) or `-p useSpringBoot4=true` (Boot 4; also unlocks useJackson3).
- Pick Boot 4 if you also want Jackson 3 — Boot 3 does not satisfy the Jackson 3 guard at KotlinClientCodegen.java:504.
- Check the parsed value is the string 'true' — e.g. YAML `useSpringBoot3: yes` may serialize as something the guard rejects.
Example fix
# before openapi-generator-cli generate -g kotlin --library=jvm-spring-restclient -i api.yaml # after openapi-generator-cli generate -g kotlin --library=jvm-spring-restclient -i api.yaml -p useSpringBoot4=true
Defensive patterns
Strategy: validation
Validate before calling
# shell: spring-restclient needs an explicit boot baseline
if [ "$LIBRARY" = "jvm-spring-restclient" ]; then
[ "$USE_SPRING_BOOT3" = "true" ] || [ "$USE_SPRING_BOOT4" = "true" ] || {
echo "jvm-spring-restclient requires useSpringBoot3=true or useSpringBoot4=true" >&2; exit 2; }
fi Try / catch
try {
DefaultGenerator().opts(clientOptInput).generate()
} catch (e: RuntimeException) {
throw IllegalStateException("jvm-spring-restclient missing Spring Boot baseline: ${e.message}", e)
} Prevention
- Always pass a boot flag when using jvm-spring-restclient; there is no default.
- Use useSpringBoot4=true if you also plan to enable useJackson3 (Boot 3 does not satisfy that guard).
- Ensure YAML booleans serialize to the literal string 'true'.
When it happens
Trigger: `-g kotlin --library=jvm-spring-restclient` with neither boot flag; or both flags explicitly false; CI scripts that only pass --library and -i.
Common situations: Assuming the generator picks a default Boot version; shared generate scripts across generators where the boot flags were only added for the spring server generator.
Related errors
- useJackson3 with jvm-spring-restclient requires useSpringBoo
- {enumSerializationLibrary} is an invalid enum property namin
- useJackson3 requires serializationLibrary=jackson
- openApiNullable cannot be set with useJackson3
- useJackson3 is only supported for the jvm-okhttp4 and jvm-sp
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/4e4bdd8f1511f982.
Report an issue: GitHub.