Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add new line to be specified for JSON formatting#100890

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@martincostello
Copy link
Member

Allow the new line string to use for indented JSON to be specified through options.

Resolves#84117.

Allow the new line string to use for indented JSON to be specified through options.Resolvesdotnet#84117.
@ghost
Copy link

Note regarding thenew-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@dotnet-policy-servicedotnet-policy-servicebot added the community-contributionIndicates that the PR has been added by a community member labelApr 10, 2024
@martincostello
Copy link
MemberAuthor

@eiriktsarpalis I've left this in draft for now before I dig around tomorrow and see if I've missed anything, but feel free to start reviewing at your convenience.

@martincostello
Copy link
MemberAuthor

Failing test isEnsureConsoleLoggerOptions_ConfigureOptions_SupportsAllProperties() - I need to update the JSON console logger options to account for the new property.

- Cater for `_newLine` in JsonSerializerOptions caching.- Lazily initialize field.- Allow null to reset to default.- Add assertions.- Add/update comments.- Use `nameof()`.- Remove redundant field.- Extend tests.
- Update property count to fix assertion.- Update test to validate `NewLine` can be set/bound.
Only normalize the line endings if the `JsonWriterOptions` are not using the defaults.
@martincostello
Copy link
MemberAuthor

I'm not sure why the Mono tests are failing - there's something in the logs about how some of the tests take a long time to run under the interpreter, so I wonder if the extra test cases I've added to the combinations forNewLine have tipped it over the edge for the 1 hour timeout?

- Access lazily initialized field through property.- Update hash code assertion.
Use similar format string to `Format_InvalidGuidFormatSpecification`/
@martincostello
Copy link
MemberAuthor

I'm not sure why the Mono tests are failing

Looks like these areknown issues.

Reword comment as suggested.
- Simplify condition.- Disallow null for `string NewLine` properties.
@martincostellomartincostello marked this pull request as ready for reviewApril 12, 2024 13:57
@eiriktsarpalis
Copy link
Member

I'm not sure why the Mono tests are failing

Looks like these areknown issues.

We generally use the "Build Analysis" leg to determine if there any test failures that haven't been flagged as known issues.

martincostello and WeihanLi reacted with thumbs up emoji

Copy link
Member

@eiriktsarpaliseiriktsarpalis left a comment

Choose a reason for hiding this comment

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

Thanks!

martincostello reacted with heart emoji
@eiriktsarpaliseiriktsarpalis merged commit6171ab5 intodotnet:mainApr 16, 2024
@martincostellomartincostello deleted the gh-84117-stj-jsonserializationoptions-newline branchApril 16, 2024 15:47
matouskozak pushed a commit to matouskozak/runtime that referenced this pull requestApr 30, 2024
* Add new line to be specified for JSON formattingAllow the new line string to use for indented JSON to be specified through options.Resolvesdotnet#84117.* Address review feedback- Cater for `_newLine` in JsonSerializerOptions caching.- Lazily initialize field.- Allow null to reset to default.- Add assertions.- Add/update comments.- Use `nameof()`.- Remove redundant field.- Extend tests.* Update Logging.Console tests- Update property count to fix assertion.- Update test to validate `NewLine` can be set/bound.* Only normalize line endings if neededOnly normalize the line endings if the `JsonWriterOptions` are not using the defaults.* Address feedback- Access lazily initialized field through property.- Update hash code assertion.* Update exception messageUse similar format string to `Format_InvalidGuidFormatSpecification`/* Address feedbackReword comment as suggested.* Address feedback- Simplify condition.- Disallow null for `string NewLine` properties.
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 17, 2024
@martincostellomartincostello added this to the9.0.0 milestoneOct 15, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@stephentoubstephentoubstephentoub left review comments

@bartonjsbartonjsbartonjs left review comments

@eiriktsarpaliseiriktsarpaliseiriktsarpalis approved these changes

Assignees

No one assigned

Labels

area-System.Text.Jsoncommunity-contributionIndicates that the PR has been added by a community membernew-api-needs-documentation

Projects

None yet

Milestone

9.0.0

Development

Successfully merging this pull request may close these issues.

[API Proposal]: Add the ability to specify line endings when serializing Json

4 participants

@martincostello@eiriktsarpalis@stephentoub@bartonjs

[8]ページ先頭

©2009-2025 Movatter.jp