OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.46k stars 6.49k forks source link

[BUG] java microprofile - microprofileRestClientVersion 3.0 generated client uses javax for base package of bean validators #15180

Closed barnabycourt closed 10 months ago

barnabycourt commented 1 year ago

Bug Report Checklist

Description

When configuring a java microprofile generator 3 & beanvalidation & jakartaEE

Specifically using the gradle generator plugin I am specifying

configOptions = [ sourceFolder : "src/gen/java", interfaceOnly : "true", library : "microprofile", java8 : "true", dateLibrary : "java8", useBeanValidation: "true", microprofileRestClientVersion: "3.0", useJakartaEE: "true", ]

The problem I am seeing is that if useBeanValidation and useJaktaEE are true then the imports in the generated java classes use "javax." and not "jakarta."

openapi-generator version

I am using org.openapitools:openapi-generator-gradle-plugin:6.5.0

OpenAPI declaration file content or url

The specific problem appears to be because {{javaxPackage}} was used instead of {{rootJavaEEPackage}} in the api.mustache file at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/api.mustache#L23

Related issues/PRs

I created a A PR to patch https://github.com/OpenAPITools/openapi-generator/pull/15179

jochenr commented 10 months ago

Hi, any news here? I have the same issue. Thanky you

PS: oh I just recognized....I have the same problem, but with the maven-plugin...

barnabycourt commented 10 months ago

This issue should actually be closed. It was fixed in openapi 6.6.0 when https://github.com/OpenAPITools/openapi-generator/pull/15179 was merged.

@jochenr if you can identify which template needs updating or a reproducer it would be helpful.