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

Updated references to JsonIgnore - applies to enum members #20

Merged

Conversation

2BitSalute
Copy link
Contributor

@2BitSalute 2BitSalute commented Sep 28, 2024

Update the documentation in accordance with the change in json-everything/json-everything#796

In addition to properties, enum members can now also be decorated with JsonIgnoreAttribute or JsonExcludeAttribute. The effect is that the ignored/excluded members can be excluded from the schema generation, but still appear in other kinds of serialization or code generation.

Depends on json-everything/json-everything#799

@2BitSalute 2BitSalute marked this pull request as ready for review September 28, 2024 03:56
@@ -22,7 +22,7 @@ Indicates that the property should be excluded from generation.

This attribute functions exactly the same as the **System.Text.Json.Serialization.JsonIgnoreAttribute**. It
is included separately to support the case where the model should be serialized with
a property but schema generation should ignore it.
a property or an enum member but schema generation should ignore it.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to update thes /api docs. These will be rebuilt automatically from the source after the libs merge to master.

You'll need to back out this change and force push. Otherwise, there will be merge conflict (and you'll have to do it anyway).

Copy link
Contributor Author

@2BitSalute 2BitSalute Sep 30, 2024

Choose a reason for hiding this comment

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

Ah, but I didn't update the XML doc comment on JsonExclude. Need to do that, then!

TBH, I didn't carefully read the verbiage saying it only applies to properties (otherwise I wouldn't have expected it to work on enums). I'll go check the code repo for XML comments etc. to see what else I might have missed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

TBH, I didn't carefully read the verbiage saying it only applies to properties (otherwise I wouldn't have expected it to work on enums).

I still think it's an improvement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that. PR: json-everything/json-everything#801

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I still think it's an improvement.

Yeah, that's what I was saying, I was just projecting my assumptions, but the documentation clearly stated the intent

_docs/schema/schemagen/schema-generation.md Show resolved Hide resolved
@gregsdennis gregsdennis merged commit 24bfd6d into json-everything:main Sep 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants