Escape JavaDoc default values safely
Description
Generated Java clients fail to compile when an OpenAPI parameter default value contains */, such as */*. The value is currently interpolated directly into a JavaDoc comment, prematurely closing the comment block.
Register a Java-specific Mustache lambda and apply it at the JavaDoc interpolation site. The lambda replaces the slash in */ with the HTML entity /, preserving the rendered documentation value without changing the generated Java semantics.
A regression test covers comment terminators and leaves ordinary values unchanged.
Fixes #24852
Validation
./mvnw -B -pl modules/openapi-generator -am -Dtest=org.openapitools.codegen.templating.mustache.EscapeJavaDocLambdaTest -Dsurefire.failIfNoSpecifiedTests=false test
Was generative AI tooling used to co-author this PR?
- Yes — Copilot
Generated-by: Copilot following the guidelines in the project contribution documentation.
Drafted-by: Copilot (no human review before posting)
Summary by cubic
Fixes generated Java clients failing to compile when a default value contains */ (for example */*), which prematurely closed the JavaDoc comment. Default values in JavaDoc are now escaped to */, preserving rendered text and generated behavior, and string example values like */* are no longer mangled in generated source.
- Registers an
escapeJavaDoclambda in the codegen lambda map and invokes it as{{#lambda.escapeJavaDoc}}in templates; the bare{{#escapeJavaDoc}}reference never resolves and silently drops default values. - Applies the escaping to JavaDoc comments across Java library API templates, leaving regular line comments literal.
- Escapes string example values for Java string literals without
escapeUnsafeCharacters, so wildcard media types stay intact. - Adds regression tests and a
wildcard-accept-headersample covering comment terminators and ordinary values.