docs: document custom-interceptors config for the Java SDK generator - #6509
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
🌿 Preview your docs: https://fern-preview-devin-1785769977-java-custom-interceptors-docs.docs.buildwithfern.com/learn Here are the markdown pages you've updated: |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
| custom-interceptors: true | ||
| ``` | ||
|
|
||
| Developers using your SDK register interceptors as they construct the client. Each call to `addInterceptor` adds to the set, and all of them are applied to the underlying `OkHttpClient` at build time: |
Contributor
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Microsoft.Wordiness] Consider using 'all' instead of 'all of'.
…pport Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devalog
approved these changes
Aug 3, 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
custom-interceptorshas shipped in the Java SDK generator since 3.41.0 (2026-03-03) but only ever appeared in the generator changelog, so a customer reading/learn/sdks/generators/java/configurationhas no way to discover it. This adds the config option to the Java configuration reference and a usage section to the Java custom-code page.Behavior documented here was verified empirically, not inferred from the changelog: two
fern generate --localruns againstfernapi/fern-java-sdk:4.16.0on the same spec, differing only byconfig: custom-interceptors: true. With the flag, the generated builder gainsplus the matching
ClientOptions.Builder.addInterceptor(...); the control run has none of them.setInterceptorsis generated whenever the flag is on (it does not requireenable-extensible-builders), which is why it's listed in the extensible-builder method reference table as conditional oncustom-interceptorsrather than on the builder flag.Two review questions are answered from the generator source (
ClientOptionsGenerator.java) and thejava-sdkseed fixtures underseed/java-sdk/*/custom-interceptors/, each condensed to a clause on the page:Ordering relative to
RetryInterceptor.ClientOptions.Builder.build()registers interceptors in this order, and OkHttp invokes application interceptors in registration order:Custom interceptors sit innermost, so
RetryInterceptor.retryChain()'s repeatedchain.proceed(...)re-enters them on every attempt: a signing interceptor signs each attempt independently rather than replaying the first signature.OAuth staged builders. 3.42.5 added
interceptors/addInterceptorto the_Builderinner class and forwarding throughtoken()/credentials(). The seed fixture confirmsaddInterceptorexists both on_Builderand on the auth-stage builders (_TokenAuth,_CredentialsAuth), so the existingbuilder().token(...).addInterceptor(...)example is already correct for OAuth APIs; the page notes registration works on either side of the auth call.Link to Devin session: https://app.devin.ai/sessions/018daf6fd74d4413a3b89f4f5c706f96