[CAT-2382] Enable useSingleRequestParameter for Java Client Generator#203
Merged
dvacca-onfido merged 1 commit intomasterfrom Feb 12, 2026
Merged
Conversation
Add useSingleRequestParameter option to Java okhttp-gson generator configuration to prevent breaking changes when adding optional parameters to API methods. This configuration generates a request builder pattern where: - API methods return request objects with fluent setters for optional parameters - .execute() must be called to perform the actual API request - New optional parameters become new setter methods, not new method parameters Benefits: - Backward compatibility: existing code continues to work when new optional params are added - Forward compatibility: new optional parameters don't break existing implementations - Cleaner API: optional parameters are more discoverable and explicit Example: - Before: onfido.listWorkflowRuns(applicantId, status, page, sort) - After: onfido.listWorkflowRuns().applicantId(id).status(status).page(1).execute()
sanchapereira
approved these changes
Jan 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables the
useSingleRequestParameterconfiguration option for the Java okhttp-gson client generator to prevent breaking changes when adding optional parameters to API methods.Problem
Currently, when a new optional parameter is added to an API endpoint, the generated Java client adds a new parameter to the method signature. This creates a breaking change for existing implementations, forcing all consumers to update their code even if they don't need the new parameter.
Solution
The
useSingleRequestParameteroption changes the code generation pattern to use request builder objects:Before (breaking changes on new optional params)
After (backward compatible)
Benefits
Changes
useSingleRequestParameter: truetogenerators/java/okhttp-gson/config.yamlTesting
Migration Notes
This is a breaking change that requires updating all API method calls to use
.execute(). However, once adopted, future changes will be non-breaking.Related PRs