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

System.Text.Json - Emit XML comments for public source-generated APIs #72761

Merged
merged 4 commits into from
Jul 26, 2022

Conversation

JakeYallop
Copy link
Contributor

@JakeYallop JakeYallop commented Jul 25, 2022

Fixes #61379.

I'd love to get this into NET 7.0 if possible, but realise that I may have left it slightly too late to find the time to make this fix.

I was in two minds about adding a test that verifies the contents of the documentation itself. In the end I just added a test that verifies that the diagnostic mentioned in #61379 is not produced as I thought that verifying the comments themselves would just be a maintenance burden every time the API surface changes or is updated.

Some examples of the comments emitted during source generation are included below. I've used <see cref="type" /> where possible, but for any closed generic types I've just emitted a best attempt at a friendly version of that type, as we can't reference closed generic types in cref attributes.

Edit: Simplified the emitted comments, following the feedback on the change.

Examples of the comments emitted

Constructor:
image

Default context:
image

GeneratedSerializerOptions:
image

GetTypeInfo:
image

JsonTypeInfo:
image

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Jul 25, 2022
@ghost
Copy link

ghost commented Jul 25, 2022

Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #61379.

I'd love to get this into NET 7.0 if possible, but realise that I may have left it slightly too late to find the time to make this fix.

I was in two minds about adding a test that verifies the contents of the documentation itself. In the end I just added a test that verifies that the diagnostic mentioned in #61379 is not produced as I thought that verifying the comments themselves would just be a maintenance burden every time the API surface changes or is updated.

Some examples of the comments emitted during source generation are included below. I've used <see cref="type" /> where possible, but for any closed generic types I've just emitted a best attempt at a friendly version of that type, as we can't reference closed generic types in cref attributes.

Examples of the comments emitted

Constructors:
image
image

Default context:
image

GeneratedSerializerOptions:
image

GetTypeInfo:
image

JsonTypeInfo:
image
image
image
image
image

Author: JakeYallop
Assignees: -
Labels:

area-System.Text.Json

Milestone: -

Copy link
Member

@eiriktsarpalis eiriktsarpalis left a comment

Choose a reason for hiding this comment

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

Thanks, I really appreciate this contribution 👍

@eiriktsarpalis eiriktsarpalis merged commit 8fc7be6 into dotnet:main Jul 26, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use of JsonSerializerContext Can Cause CS1591
3 participants