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

Add OptIn serialization attribute for C# generated types #516

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

aasoni
Copy link
Contributor

@aasoni aasoni commented Nov 1, 2023

Description of Changes

Generate the OptIn Json.NET attribute (https://www.newtonsoft.com/json/help/html/JsonObjectAttributeOptIn.htm) for autogenerated C# types.
This fixes a bug where user generated properties in partial classes get serialized to json as well. This caused a deserialization issue on the server, when a user generated property was the last one, resulting in the following error:
image

API and ABI

  • This is a breaking change to the module ABI
  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

If the API is breaking, please state below what will break

Expected complexity level and risk

How complicated do you think these changes are? Grade on a scale from 1 to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex change.

1

This complexity rating applies not only to the complexity apparent in the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning ways.

@aasoni aasoni requested a review from jdetter November 1, 2023 16:22
@aasoni aasoni changed the title Add OptIn serialization attribute Add OptIn serialization attribute for C# generated types Nov 1, 2023
Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

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

LGTM

@jdetter
Copy link
Collaborator

jdetter commented Nov 1, 2023

Yeah this is a known issue with json serialization, this should be a good fix for now 👍

@jdetter jdetter merged commit cdda98b into master Nov 1, 2023
5 checks passed
kulakowski pushed a commit that referenced this pull request Nov 7, 2023
* Add OptIn serialization attribute

* Run rust fmt
kulakowski pushed a commit that referenced this pull request Nov 7, 2023
* Add OptIn serialization attribute

* Run rust fmt
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.

3 participants