Skip to content

feature/batches execution #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 22, 2021
Merged

Conversation

baywet
Copy link
Member

@baywet baywet commented Jan 21, 2021

  • adds an execute method for JSON batches to avoid customers juggling with clients
  • reverts string serialization bypass to avoid unconsistent behavior
  • adds defensive programming - switches to json objects to avoid too much string manipulations - fixes a bug where the service root would be appended twice - adds missing unit tests

This PR not only improves code coverage and reliability of the whole batching implementation, but also makes usage simpler.
https://github.com/microsoftgraph/microsoft-graph-docs/compare/feature/java-sdk-v3?expand=1

@baywet baywet self-assigned this Jan 21, 2021
@baywet baywet added this to the 2.0.0 milestone Jan 21, 2021
- switches to json objects to avoid too much string manipulations
- fixes a bug where the service root would be appended twice
- adds missing unit tests
@baywet baywet force-pushed the feature/batches-execution branch from 96fa18d to 73219ae Compare January 21, 2021 18:40
@tbelaire
Copy link
Contributor

Just as a note, if you're redoing how this batch request works, I would find it much more useful if it didn't reference okhttp Requests, as I've already hooked up our own IConnection and IHttpProvider, and don't really want to use okhttp.

What would be ideal from my perspective would be a BatchRequest extends BaseRequest with a method like public JsonObject post(BatchRequest batchRequest), where the BatchRequest is some trivially serializable to Json with a list of BatchRequestItems. But these BatchRequestItems could be subclassed for each request type when generating the rest of the classes automatically:

  class UpdateMessageBatchRequestItem extends BatchRequestItem {
    @Expose public Message body;
  }

Then IMessageRequest could expose toBatchRequest which would mean that you could build up these
batch requests in the same way as you'd use the rest of the GraphApi sdk.

Sorry if this feedback comes too late, or isn't too useful here.

- makes internal method private
@baywet
Copy link
Member Author

baywet commented Jan 21, 2021

@tbelaire I think this is very valuable feedback that is unlocked by the fact that all the base requests used to be in the service library and now are in this core library.
At this point I wasn't looking at rebuilding the whole batch constructs, I only fixed issues that were obvious and added a superset method to facilitate usage and avoid juggling with clients.

I don't want to block the v3 release on that and I want to involve the program managers in that potential redesign. I agree with the fact that the current implementation is overly complex and reimplements things we should get from the httpprovider and other layers. Do you mind opening a new issue providing all the details you already provided please?

…ests

- enables and fixes last disabled tests for CoreHttpProvider
@baywet baywet merged commit e3ac12d into rsh/AzureIdentityAuth Jan 22, 2021
@baywet baywet deleted the feature/batches-execution branch January 22, 2021 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants