Repository navigation
Conversation
jbeckwith-oai
left a comment
There was a problem hiding this comment.
Reviewed the dependency-scope change and optional Swagger module wiring on the exact head. The core runtime graph and generated publication POM no longer export swagger-annotations; structured-output tests, example compilation, and Kotlin lint pass. I also smoke-tested schema generation on a runtime classpath with Swagger annotations removed and confirmed the Jackson-only path succeeds. The implementation is direct and preserves annotated behavior when either compatible annotation artifact is available. LGTM.
…lict Stop re-exporting javax swagger-annotations as an api dependency so consumers can use swagger-annotations-jakarta without split-package clashes. Register Swagger2Module only when Schema is on the classpath, and document that @Schema users must declare the annotation artifact. Fixes openai#796
d3d4878 to
39fb1f0
Compare
…otations-compile-only Keep swagger-annotations compileOnly after the dependency lists moved into CoreCompilationDependencies.
Castiron custom codeEvaluated main: Trusted main policy: ✅ No new custom-code files detected. 93 mixed files remain; 0 existing customizations changed. Compared 93 existing customizations unchanged
53 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 40458689194 --repo openai/openai-java \
--name castiron-custom-code-40458689194-1 --dir /tmp/castiron-custom-code-40458689194-1
git apply --stat /tmp/castiron-custom-code-40458689194-1/custom-code.patch
cat /tmp/castiron-custom-code-40458689194-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin a565f6e12496d129699f3732d3ead2b9f1d0691e 8fa1daf9a63eb048bb415a3f59944b1ef8173770
python3 scripts/castiron/custom_code_report.py report \
--base a565f6e12496d129699f3732d3ead2b9f1d0691e \
--head 8fa1daf9a63eb048bb415a3f59944b1ef8173770 --target-branch main --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-8fa1daf9a63e
cat /tmp/castiron-custom-code-8fa1daf9a63e/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
Summary
Fixes #796.
openai-java-coredeclaredapi("io.swagger.core.v3:swagger-annotations:…"), which forced the javax Swagger annotations artifact onto every consumer classpath. That conflicts withswagger-annotations-jakarta(same packageio.swagger.v3.oas.annotations), common in Spring Boot 3 / springdoc apps.Change
swagger-annotationsascompileOnly(plustestImplementationfor SDK tests) so it is not a published transitive dependency.Swagger2Moduleonly whenio.swagger.v3.oas.annotations.media.Schemais loadable, so structured outputs still work when neither annotation artifact is present (Jackson annotations continue to drive schema generation).swagger-annotationsdependency toopenai-java-example(examples use@Schema/@ArraySchema).swagger-annotationsorswagger-annotations-jakartathemselves.Tradeoff
Consumers who need Swagger annotations at compile time for their own schema classes must declare the dependency themselves (javax or jakarta coordinate). That is intentional: the SDK should not pick a side and break the other ecosystem. Jackson-based schema generation needs no extra dependency.
jsonschema-module-swagger-2already treatsswagger-annotationsasprovided; this aligns the SDK with that model.Competing PRs
Searched open/closed PRs for
swagger/#796onopenai/openai-javabefore opening — none found covering this change.Test plan
./gradlew :openai-java-core:compileKotlin :openai-java-example:compileJava./gradlew :openai-java-core:test --tests 'com.openai.core.StructuredOutputsTest'— 95 tests, 0 failures (JDK 21)pom-default.xmlno longer listsswagger-annotations(onlyjsonschema-module-swagger-2, which does not transitively pull annotations)