WebApi
WebApi copied to clipboard
bulk ops deserialization
Issues
Description
This pull request is a sub of this big PR #2656. We have broken the big PR into 3PRs - deserialization/serialization/ApiHandlers to hasten the review. This PR contains only deserialization changes for bulk operations.
N/B: This PR seems big but it is not really big, most of the changes are minor changes - like removing or adding whitespace where needed. A sample delta payload will look like below:
{
"@odata.context": "http://host/service/$metadata#Customers/$delta",
"value": [
{
"Id": 1,
"Name": "Customer1",
"[email protected]": [
{
"Id": 1,
"Street": "123 Street",
"City": "Redmond"
},
{
"Id": 2,
"Street": "234 Street",
"City": "Seattle"
}
]
},
{
"Id": 2,
"Name": "Customer2",
"[email protected]": [
{
"@odata.removed": {
"reason": "removed"
},
"Id": 1
},
{
"Id": 12,
"Street": "434 Street",
"City": "Seattle"
}
]
}
]
}
some of the main changes are: We have added the following classes and interfaces to assist in the deserialization of delta payloads- like the one shown above.:
- IDeltaSetItem - A basic interface representing a delta item.
- IDeltaSet - A basic delta representing a deltaset - collection of deltas
- IDeltaDeletedEntityObject - Represents a typed deleted entity object.
- IODataIdContainer - An interface to hold ODataId -
@odata.id- in parsed format. Used by both POCO objects and Delta<TStructuralType> - ODataResourceSetWrapperBase - Encapsulates an ODataResourceSet or ODataDeltaResourceSet
- DeltaSet<TStructuralType> - Represents an IDeltaSet that is a collection of IDeltaSetItem.
- DeltaDeletedEntityObject<TStructuralType> - Used to hold the Deleted Entry object in the Delta Feed Payload.
Changes have also been made to the ODataReaderExtensions - we check for the readerstate - if there is a deltaresourcesetstart state, we'll create an odatadeltaresourceset.
Changes have also been made to the ODataResourceSetDeserializer and ODataResourceDeserializer to handle creating a deltaset from a delta request payload.
Checklist (Uncheck if it is not completed)
- [ ] Test cases added
- [ ] Build and test with one-click build and test script passed
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.
Left some comments, suggestions and a few things that looked like potential bugs.
The PR seems to introduce potentially breaking changes, is it meant for 7.x?
There seems to be a lot of changes made to existing tests that I didn't quite understand, which lowered my confidence in figuring out whether the PR doesn't break things.
@habbes the main reason there are some changes to the tests is because there is some logic that didn't work as expected before. The logic was changed and now works correctly hence the reason why some tests were removed completely or changes made to them.
I also worry about the "changes" for existing scenarios. Any docs to list the "reasons"?
This PR has 1831 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!
Quantification details
Label : Extra Large
Size : +1421 -410
Percentile : 100%
Total files changed: 63
Change summary by file extension:
.cs : +1183 -391
.resx : +18 -0
.projitems : +13 -0
.csproj : +6 -1
.bsl : +201 -18
Change counts above are quantified counts, based on the PullRequestQuantifier customizations.
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a balance between between PR complexity and PR review overhead. PRs within the optimal size (typical small, or medium sized PRs) mean:
- Fast and predictable releases to production:
- Optimal size changes are more likely to be reviewed faster with fewer iterations.
- Similarity in low PR complexity drives similar review times.
- Review quality is likely higher as complexity is lower:
- Bugs are more likely to be detected.
- Code inconsistencies are more likely to be detected.
- Knowledge sharing is improved within the participants:
- Small portions can be assimilated better.
- Better engineering practices are exercised:
- Solving big problems by dividing them in well contained, smaller problems.
- Exercising separation of concerns within the code changes.
What can I do to optimize my changes
- Use the PullRequestQuantifier to quantify your PR accurately
- Create a context profile for your repo using the context generator
- Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the
Excludedsection from yourprquantifier.yamlcontext profile. - Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your
prquantifier.yamlcontext profile. - Only use the labels that matter to you, see context specification to customize your
prquantifier.yamlcontext profile.
- Change your engineering behaviors
- For PRs that fall outside of the desired spectrum, review the details and check if:
- Your PR could be split in smaller, self-contained PRs instead
- Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).
- For PRs that fall outside of the desired spectrum, review the details and check if:
How to interpret the change counts in git diff output
- One line was added:
+1 -0 - One line was deleted:
+0 -1 - One line was modified:
+1 -1(git diff doesn't know about modified, it will interpret that line like one addition plus one deletion) - Change percentiles: Change characteristics (addition, deletion, modification) of this PR in relation to all other PRs within the repository.
Was this comment helpful? :thumbsup: :ok_hand: :thumbsdown: (Email) Customize PullRequestQuantifier for this repository.