Skip to content

Fix x-spring-provide-args handling. Pass arguments to delegates. Use JavaParser. - #24071

Open
wilx wants to merge 1 commit into
OpenAPITools:masterfrom
wilx:fix-x-spring-provide-args-with-java-parser
Open

wilx wants to merge 1 commit into
OpenAPITools:masterfrom
wilx:fix-x-spring-provide-args-with-java-parser

Conversation

@wilx

@wilx wilx commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

This fixes #24063. This is an alternative to #24064. This utilizes JavaParser instead of regular expressions to extract the information it needs.


Summary by cubic

Fixes x-spring-provide-args: replaces regex parsing with JavaParser and forwards provided args across API interfaces, controllers, and delegates in all mapping modes. Previously, provided args were not reliably parsed or passed to delegates; now they are parsed as Java parameters, imports are generated, and signatures/ordering are consistent.

  • Parse with com.github.javaparser and auto-import; simplify fully qualified annotation and generic type names (incl. nested generics).

  • Emit annotated parameters for interfaces/controllers; strip annotations in delegates. Add vendor extensions springProvideArgsNames and springProvideArgsDelegate; update api.mustache, apiController.mustache, and apiDelegate.mustache to pass args by name, including api_interface and interface-only modes.

  • Preserve Pageable position and fix commas/ordering with request context, reactive, and provided args. Add tests covering with/without provide-args, pageable, reactive, controller-to-delegate, and api_interface.

  • Dependencies: move com.github.javaparser:javaparser-core to compile scope.

Written for commit 68697cf. Summary will update on new commits.

Review in cubic

@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch from 80ccb69 to c3766cd Compare June 19, 2026 18:47

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread modules/openapi-generator/src/main/resources/JavaSpring/api.mustache Outdated
@wing328

wing328 commented Jun 24, 2026

Copy link
Copy Markdown
Member

please resolve the merge conflicts when you've time

@wilx

wilx commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

please resolve the merge conflicts when you've time

Resolved.

@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch 2 times, most recently from c75169d to 80f02f7 Compare June 28, 2026 18:05
@wilx
wilx marked this pull request as draft June 28, 2026 19:00
@wilx

wilx commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

I have identified some issues with the patch related to comma handling. I am working on a fix.

@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch from 80f02f7 to b85a6a1 Compare June 28, 2026 19:33
@wilx
wilx marked this pull request as ready for review June 28, 2026 19:33

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 11 files

Re-trigger cubic

@wilx

wilx commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

I think this is ready.

@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch from b85a6a1 to 694ca42 Compare July 21, 2026 23:15
@wilx

wilx commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Rebased.

@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch from 694ca42 to 3a6d6c9 Compare July 26, 2026 08:28
@wilx
wilx force-pushed the fix-x-spring-provide-args-with-java-parser branch from 3a6d6c9 to 68697cf Compare August 20, 2026 18:39
@wilx

wilx commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Rebased.

@wilx

wilx commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@wing328 Is there a chance this can be included in the next release?

@wing328

wing328 commented Sep 6, 2026

Copy link
Copy Markdown
Member

thanks for the PR

cc Spring technical committee: @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) @KannaKim (2026/07) to see if they've any question/feedback.

@wilx

wilx commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Is there anything I can do to push this through? The bug is real and this change fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Spring generator bug with x-spring-provide-args + interfaceOnly=true + delegatePattern=true + requestMappingMode=api_interface

2 participants