Bug Report Checklist
Description
With the Java generator, the microprofile library, Jackson serialization, and useJakartaEe=true, enabling useOneOfInterfaces=true generates the oneOf interface with @javax.annotation.Generated rather than @jakarta.annotation.Generated.
This occurs with both useSealedOneOfInterfaces=false and useSealedOneOfInterfaces=true. The sealed option is not the cause; both modes use the shared oneOf interface template.
This makes generated models fail to compile in a Jakarta-only application, including Quarkus 3, unless the consumer adds a compile-only javax.annotation:javax.annotation-api dependency solely for the generated annotation.
The same result is produced when useSealedOneOfInterfaces is omitted or set to false.
The generated oneOf interface contains:
@javax.annotation.Generated(...)
public sealed interface Request permits NormalRequest, EmergencyRequest {
}
The generated code fails in a Jakarta-only project because javax.annotation.Generated is absent.
With useJakartaEe=true, the generated oneOf interface should contain:
@jakarta.annotation.Generated(...)
public sealed interface Request permits NormalRequest, EmergencyRequest {
}
openapi-generator version
7.24.0. Probably not a regression.
OpenAPI declaration file content or url
Minimal OpenAPI 3.0.3 document:
openapi: 3.0.3
info:
title: oneOf Jakarta test
version: 1.0.0
paths: {}
components:
schemas:
Request:
oneOf:
- $ref: "#/components/schemas/NormalRequest"
- $ref: "#/components/schemas/EmergencyRequest"
NormalRequest:
type: object
properties:
kind:
type: string
enum: [normal]
EmergencyRequest:
type: object
properties:
kind:
type: string
enum: [emergency]
Generation Details
Generation options:
generatorName=java
library=microprofile
serializationLibrary=jackson
useJakartaEe=true
useOneOfInterfaces=true
useSealedOneOfInterfaces=true
Steps to reproduce
- Save above reproducing yaml to file
- Generate using options given above
- Inspect
@Generated statements of generated model
Related issues/PRs
Suggest a fix
Ensure the shared oneOf interface generation path resolves @Generated through the generator's configured javaxPackage, as the regular Java/MicroProfile model generation path does.
Please add regression coverage for the Java microprofile library with Jackson, useJakartaEe=true, useOneOfInterfaces=true, and useSealedOneOfInterfaces=true; assert that the generated oneOf interface uses jakarta.annotation.Generated.
Workaround
Consumers can add:
compileOnly "javax.annotation:javax.annotation-api:1.3.2"
Generated has source retention, so this is a compile-time bridge only. It should not be necessary when useJakartaEe=true.
Note: This issue was reported with AI assistance. The reproduction and generated output were verified by the reporter.
Bug Report Checklist
Description
With the Java generator, the
microprofilelibrary, Jackson serialization, anduseJakartaEe=true, enablinguseOneOfInterfaces=truegenerates the oneOf interface with@javax.annotation.Generatedrather than@jakarta.annotation.Generated.This occurs with both
useSealedOneOfInterfaces=falseanduseSealedOneOfInterfaces=true. The sealed option is not the cause; both modes use the shared oneOf interface template.This makes generated models fail to compile in a Jakarta-only application, including Quarkus 3, unless the consumer adds a compile-only
javax.annotation:javax.annotation-apidependency solely for the generated annotation.The same result is produced when
useSealedOneOfInterfacesis omitted or set tofalse.The generated oneOf interface contains:
The generated code fails in a Jakarta-only project because
javax.annotation.Generatedis absent.With
useJakartaEe=true, the generated oneOf interface should contain:openapi-generator version
7.24.0. Probably not a regression.
OpenAPI declaration file content or url
Minimal OpenAPI 3.0.3 document:
Generation Details
Generation options:
Steps to reproduce
@Generatedstatements of generated modelRelated issues/PRs
useSealedOneOfInterfacessupport for the Java MicroProfile library in 7.24.0.Suggest a fix
Ensure the shared oneOf interface generation path resolves
@Generatedthrough the generator's configuredjavaxPackage, as the regular Java/MicroProfile model generation path does.Please add regression coverage for the Java
microprofilelibrary with Jackson,useJakartaEe=true,useOneOfInterfaces=true, anduseSealedOneOfInterfaces=true; assert that the generated oneOf interface usesjakarta.annotation.Generated.Workaround
Consumers can add:
compileOnly "javax.annotation:javax.annotation-api:1.3.2"Generatedhas source retention, so this is a compile-time bridge only. It should not be necessary whenuseJakartaEe=true.Note: This issue was reported with AI assistance. The reproduction and generated output were verified by the reporter.