OpenAPITools / OpenAPITools/openapi-generator
[REQ] okhttp-json: provide access to original function name
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
Right now, if I call a function like getAPIGroup, there is no easy way to associate this with the HTTP request, unless I walk the stack or similar. For example, when tracing I would like to know the http request originated from this, vs guess based on the resulting path.
Describe the solution you'd like
I typically use okhttp's request tag for this, but it currently used to stash a custom callback.
one way out could be to have a wrapper whose toString is the calling function, and this wraps the callback to execute.
Then, a simple okhttp filter can tag the value of that.. tag, and know where it came from.
Describe alternatives you've considered
Another way is a synthetic header, and another way is to try to reverse engineer it or walk up the stack (expensive).
Another expensive way is to make a dynamic proxy then trace before going into it openapi.
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated okhttp-gson ApiClient.java reference around line 1371 and examine how the request tag currently stores the custom callback. Determine a concrete way for an HTTP interceptor to access the originating function name without stack walking, then define tests showing that the name is available on the request and remains usable during callback execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100