Fix .NET SDK serialization bugs in SubFormFieldRuleAction.TypeEnum and optional int request fields#523
Open
mwojcik-dropbox wants to merge 2 commits intomainfrom
Open
Fix .NET SDK serialization bugs in SubFormFieldRuleAction.TypeEnum and optional int request fields#523mwojcik-dropbox wants to merge 2 commits intomainfrom
mwojcik-dropbox wants to merge 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two targeted post-generation patches in sdks/dotnet/bin/copy-constants.php:
SubFormFieldRuleAction.TypeEnum — swap StringEnumConverter for a dedicated TypeEnumJsonConverter that maps by numeric value. The legacy alias members (FieldVisibility, GroupVisibility) share underlying int values with their canonical counterparts, which caused StringEnumConverter to occasionally emit the raw C# identifier on the wire and get rejected by the API with HTTP 400.
Optional int request fields — sweep model files and flip [DataMember(..., EmitDefaultValue = true)] → false for optional non-nullable ints. openapi-generator was forcing "foo": 0 onto the wire for unset fields, which the API rejected for range-validated properties like font_size ('font_size' must be between 7 and 49). The sweep skips Response files so response-side round-trip fidelity (required by Api.* fixture tests) is preserved. Required fields are untouched (regex requires IsRequired = true, to be absent). Current pattern touches 5 request-side models carrying font_size; new optional ints on request-side models will be picked up automatically on regeneration.
Added SubFormFieldRuleActionTests to pin the TypeEnum wire contract (serialization, deserialization, and rejection of non-wire values).
No public API surface changes to the generated SDK — property signatures, constructor arity, and enum members are all unchanged.