Skip to content
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

chore: add System.Text.Json attributes #9341

Merged
merged 5 commits into from
Oct 25, 2023

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Oct 25, 2023

What included in this PR
This PR add following System.Text.Json's attributes to existing Newtonsoft.Json based models.

  • JsonPropertyName
  • JsonIgnore
  • JsonExtensionData
  • JsonConstructor

What's tested on my local environment
In this PR. attributes are manually added.
So I've verified attributes are aligned with existing Newtonsoft.Json value with reflection API.

Background
This PR is intended to be used for #8968. (Because JsonSchema.Net support only System.Text.Json attributes)
So JsonConverter for System.Text.Json is not added in this PR.

To fully migrate to System.Text.Json. #8137 to be resolved.

@codecov
Copy link

codecov bot commented Oct 25, 2023

@yufeih yufeih added the engineering Makes the pull request to appear in the "Engineering" section of the next release note label Oct 25, 2023
Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

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

Looks good.

@yufeih yufeih merged commit 893f794 into dotnet:main Oct 25, 2023
7 checks passed
@filzrev filzrev deleted the chore-add-system-text-json-attrs branch October 25, 2023 13:39
@yufeih
Copy link
Contributor

yufeih commented Oct 25, 2023

Does OneOf helps with modeling union types for JSON schema generation?

@filzrev
Copy link
Contributor Author

filzrev commented Oct 26, 2023

Does OneOf helps with modeling union types for JSON schema generation?

It can't automatically generate schema from C# code that use custom JsonConverter.
So it needs to manually adding schemas for these types.
I thought it's required same operations when using OneOf library.

p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
* chore: add JsonExtensionData attribute of System.Text.Json

* chore: add JsonIgnore attribute of System.Text.Json

* chore: add JsonConstructor attribute of System.Text.Json

* chore: add Newtonsoft.Json namespace qualifier of JsonConverter

* chore: add JsonPropertyName attribute of System.Text.Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering Makes the pull request to appear in the "Engineering" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants