Azure / Azure/azure-sdk-for-java

[QUERY] lambda in RequestContext

Open
#44,875 1 comment 0 reactions 0 assignees View on GitHub
Client clientcore
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

**Query/Question**
`RequestContext` is composed of a sequence of `Consumer requestCallback`.

On "Paging: Query parameter re-injection (emitter work)" task, generated SDK is required to find e.g. a value of query `queryParam` on 1st HTTP GET page, and set the query parameter with that value in all subsequent paging calls.
(also, see test case https://github.com/Azure/typespec-azure/pull/2497)

E.g., user start the paging with
```
GET /endpoint/page?query=value1
```
backend returns the values, with a `{nextLinkUrl}` without `query`, and SDK would need to continue with
```
GET {nextLinkUrl}&query=value1
```

Now, with all these `Consumer requestCallback`, it is very hard for SDK code to figure out which query parameter be set, and which value it sets, in 1st HTTP GET done by user.

***Why is this not a Bug or a feature Request?***
There may exists some workaround, e.g. add a last `requestCallback` to parse the URL and extract the query and value.

But apparently this is very tricky (the order of `requestCallback` matters) and hard to read (exact to an `Atomic` or mutable `Map` and write back in 2nd call?).

**Setup (please complete the following information if applicable):**
- OS: [e.g. iOS]
- IDE: [e.g. IntelliJ]
- Library/Libraries: io.clientcore:core:1.0.0-beta.8

**Information Checklist**
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [x] Query Added
- [x] Setup information Added

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.