Skip to content

Implement asynchronous support in JsonReader - #2217

Merged
gathogojr merged 1 commit into
OData:masterfrom
gathogojr:feature/jsonreader-async
Nov 4, 2021
Merged

gathogojr merged 1 commit into
OData:masterfrom
gathogojr:feature/jsonreader-async

Conversation

@gathogojr

@gathogojr gathogojr commented Oct 12, 2021 •

Copy link
Copy Markdown
Contributor

Issues

This pull request is a partial fulfilment of #2019 .

Description

Implement asynchronous support in JsonReader

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.

@gathogojr
gathogojr marked this pull request as draft October 12, 2021 09:50
@gathogojr
gathogojr force-pushed the feature/jsonreader-async branch from e94abbe to 5dee5ef Compare October 12, 2021 10:10
@gathogojr
gathogojr force-pushed the feature/jsonreader-async branch 3 times, most recently from 6631deb to 37ad022 Compare October 29, 2021 06:58
@gathogojr
gathogojr marked this pull request as ready for review October 29, 2021 06:59
/// true if the specified exception can be caught and handled;
/// false otherwise.
///
[DebuggerStepThrough]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we using this attribute?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@KenitoInc I'd like to apply these attribute to methods that one almost never wants to step into when debugging, CheckArgumentNotNull for example. It improves the debugging experience

@gathogojr
gathogojr force-pushed the feature/jsonreader-async branch from 37ad022 to 258b430 Compare November 1, 2021 14:25
Comment thread test/FunctionalTests/Microsoft.OData.Core.Tests/Json/JsonReaderTests.cs Outdated
}

[Fact]
public async Task ReadNullStringValue()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems we can put "non-null" and "null" test in to one [Theory] test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the [Theory] test, it's \"null\" (as a string) so we're just verify that it's read as a string. In this test, its just null and we're verifying that's its read as null. I hope I understood your question correctly

@xuzhg xuzhg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:shipit:

switch (currentScope.Type)
{
case ScopeType.Root:
if (commaFound)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I almost feel like this switch would be easier to understand if there was one for commaFound == true and one for commaFound == false. Probably not worth changing now, but maybe something to consider.

Comment thread src/Microsoft.OData.Core/Json/JsonReader.cs Outdated
Comment thread src/Microsoft.OData.Core/Json/JsonReader.cs
Comment thread src/Microsoft.OData.Core/Json/JsonReader.cs Outdated
@gathogojr
gathogojr force-pushed the feature/jsonreader-async branch from 258b430 to 36c23c4 Compare November 2, 2021 05:14
@gathogojr
gathogojr force-pushed the feature/jsonreader-async branch from 36c23c4 to baeb492 Compare November 2, 2021 06:39
@pull-request-quantifier-deprecated

Copy link
Copy Markdown

This PR has 952 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       : +917 -35
Percentile : 98.4%

Total files changed: 3

Change summary by file extension:
.cs : +917 -35

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 detetcted.
  • 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 Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context 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).

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? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@gathogojr
gathogojr merged commit e05ae7c into OData:master Nov 4, 2021
@gathogojr
gathogojr deleted the feature/jsonreader-async branch November 4, 2021 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants