Repository navigation
Escape parameter defaults in Java API Javadocs - #24972
Felix-ming wants to merge 21 commits into
Conversation
Add OpenAPI specification for default value JavaDoc regression test
There was a problem hiding this comment.
1 issue found across 4 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java:1151">
P2: The shared `JavaClientCodegen.postProcessParameter` now attaches the escaped `x-java-default-value-for-javadoc` extension to every parameter of every Java generator, but only the okhttp-gson api.mustache consumes it. The same compile-breaking Javadoc bug this PR fixes still exists in the other Java library templates that render `{{#defaultValue}}` raw inside `@param` comments (apache-httpclient line 49, feign lines 33/63/100, jersey2 lines 63/100, native lines 325/355/400/423, and equivalents in resttemplate/webclient, etc.). Since the extension is already available to all of them, swapping the one section token in each is a mechanical follow-up; otherwise a user on any other Java library hits the identical failure from apache/airflow#72466.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 16 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
Looks to be a semi-duplicate of #24890? |
|
You're right — this PR substantially overlaps with #24890 and both address #24852 across the Java API Javadoc templates. The main implementation difference is that this PR prepares a Java-specific, comment-safe vendor extension in the generator and leaves This seems closer to the generator-side direction discussed on #24890, but I am happy to close this PR in favor of #24890 if that is preferred. Please let me know which direction you would like to keep. |
|
This PR is superseded by #24890, which was merged on September 23 and addresses the same JavaDoc default-value escaping across the Java library templates. I’m closing this PR to avoid duplicate maintenance. Thanks for the review and feedback. |
Fixes #24852.
Problem
The Java okhttp-gson generator renders parameter default values directly in
@paramJavadocs. Values containing Java block-comment delimiters can terminate or start a comment in the generated source and make the client fail to compile. This is observable downstream in apache/airflow#72466.Solution
Tests
./mvnw -pl modules/openapi-generator -am --batch-mode --no-transfer-progress -Dtest=JavaClientCodegenTest#shouldEscapeParameterDefaultsInOkHttpGsonApiJavadocs -Dsurefire.failIfNoSpecifiedTests=false test./mvnw -pl modules/openapi-generator -am --batch-mode --no-transfer-progress -Dtest=JavaClientCodegenTest -Dsurefire.failIfNoSpecifiedTests=false testBoth commands pass; the full
JavaClientCodegenTestclass passes 290 tests.