Skip to content

Demonstrate fix of collection typing#119

Merged
baywet merged 63 commits intomicrosoftgraph:feature/v3from
davidmoten:demo-fix-collection-typing
Nov 20, 2020
Merged

Demonstrate fix of collection typing#119
baywet merged 63 commits intomicrosoftgraph:feature/v3from
davidmoten:demo-fix-collection-typing

Conversation

@davidmoten
Copy link
Copy Markdown
Contributor

@davidmoten davidmoten commented Aug 23, 2018

related #116
fixes #25
fixes #31
fixes #120

This is what I've done:

  • changed the signature of BaseCollectionRequest to have only one generic parameter T
  • changed the constructor to expect a responseClass that extends ICollectionResponse<T>
  • added ICollectionResponse
  • send now returns an ICollectionResponse<T>
  • and more that you can see

I've just addressed the T1 class in the constructor. Handling the T2 involves a little more but is similar.

Perhaps this will help you understand the changes proposed.

@baywet

This comment has been minimized.

@baywet baywet added this to the 3.0.0 milestone Sep 4, 2020
@baywet baywet changed the base branch from dev to feature/v3 October 5, 2020 14:48
@baywet
Copy link
Copy Markdown
Member

baywet commented Nov 11, 2020

Here is a bit of context for the review.
Dave had put together 2 PRs that were demonstrating generics improvements but were not finished.
I merged the other one into this one, updated from feature/v3 (which itself is mostly up to date from dev) and started of that.
This improves significantly the use of generics and reduces the amount of generated code.

I couldn't go "all the way" removing things like collection pages, collection response etc... as the java generic type erasure "looses some information" if you don't have a type inheriting from the generic type.
Any commit prefixed with "codegen" is a code generation, and you can probably sample the review for those, other ones are manual changes. There's a lot of trial and error in the history, sorry about the mess.

The corresponding typewriter PR is here microsoftgraph/MSGraph-SDK-Code-Generator#313

The changes of this generation have been run against raptor here.
https://microsoftgraph.visualstudio.com/Graph%20Developer%20Experiences/_build/results?buildId=31836&view=results

It's complaining about the todo stuff which is normal as I haven't updated the feature/v3 branch from latest metadata in a while. Besides that raptor allowed me to catch one generation + generic issue as you can see in the latest commits.

Copy link
Copy Markdown
Collaborator

@MIchaelMainer MIchaelMainer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a review meeting online to discuss the changes. I'll follow up after I've done some testing of these changes

import java.util.Map;

/**
* The base method request builder class used for POST actions
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The base method request builder class used for OData Action POST requests that return a collection.

The naming led me to believe that this is bound to a collection, and not referring to the return type.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an action to take on that?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the request is to change the comment to proposed comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The base method request builder class used for POST actions
* The base method request builder class used for OData Action POST requests that return a collection.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like this?

@github-actions

This comment has been minimized.

@baywet
Copy link
Copy Markdown
Member

baywet commented Nov 20, 2020

@zengin @MIchaelMainer FYI we do have the type summary working now, it contains a lot of changes but as far as I can tell this PR is not removing anything. Please have a look whenever you have some time.

@baywet baywet merged commit 9c28fdc into microsoftgraph:feature/v3 Nov 20, 2020
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.

BaseRequest typing Improve IRequestBuilder Generic typing of BaseRequest, BaseStreamRequest

4 participants