-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix untagged enum unit variant support (#545)
Prior to this commit untagged enums with unit variants caused compile error because they where counted as unnamed field variants. However this is incorrect behavior and they need to rendered as unit structs that render to `null` according to serde. This commit fixes this by allowing use of `#[serde(untagged)]` attribute on enums with unit type fields. ```rust #[derive(ToSchema)] #[serde(untagged)] enum ComputeRequest { Aggregation(AggregationRequest), Breakdown, } ```
- Loading branch information
Showing
3 changed files
with
60 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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