[BUG] config option useJakartaEe in java generator has no effect
Bug Report Checklist
- [x] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [x] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When executing a code generation for the provided specification with 7.7.0 the generated file will contain validation annotation from the package "javax.validation". When doing the same in version 7.8.0 the corresponding annotations are imported from the package "jakarta.validation", even though there is a config option "useJakartaEe" that is set to false and claims to control this behavior.
openapi-generator version
7.8.0 contains the issue
7.7.0 is working fine
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: 1.0.0
title: Test
description: Test
paths: {}
components:
schemas:
test:
type: object
required:
- test
properties:
test:
type: string
minLength: 19
Generation Details
Gradle plugin definition:
task generateTest(type: GenerateTask)
tasks.named("generateCustomerEvent").get().setProperty("inputSpec", "PutLocationOfFileHere")
tasks.withType(GenerateTask).configureEach {
generatorName = "java"
outputDir = "${buildDir}/generated/sources"
configOptions = [
performBeanValidation: "true",
useBeanValidation: "true",
library: "webclient",
dateLibrary: "custom",
useJakartaEe: "false"
]
globalProperties = [
apis: "false",
models: ""
]
typeMappings = [
DateTime: "Instant",
Date: "java.time.LocalDate",
Uuid: "UUID"
]
importMappings = [
Instant: "java.time.Instant",
UUID: "java.util.UUID"
]
}
Steps to reproduce
Execute the generation for the provided specification in version 7.7.0 and 7.8.0.
#18332 and #19171 aligned the validation-api to use jakarta.* package as a previous commit had already upgraded the validation-api version to 3.x. Unfortunately this caused a regression as end users can manually specify 2.x, in which case they would still need the javax.* package.
I'll raise a PR to fix this in the coming days