-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsFixes #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 Examples of the comments emitted
|
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 👍
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 incref
attributes.Edit: Simplified the emitted comments, following the feedback on the change.
Examples of the comments emitted
Constructor:
Default context:
GeneratedSerializerOptions:
GetTypeInfo:
JsonTypeInfo: