-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support
#[serde(flatten)]
for maps. (#799)
`utoipa` already supported `#[serde(flatten)]` on fields with structure type, by putting the fields inside those structures into the parent type. This is commonly used for factoring out frequently used keys, as documented at <https://serde.rs/attr-flatten.html#factor-out-frequently-grouped-keys>. `#[serde(flatten)]` has another use that utoipa does not support: to capture additional unnamed fields within a structure, as documented at <https://serde.rs/attr-flatten.html#capture-additional-fields>. This commit adds support for that functionality as well as a pair of tests. It only makes sense to have one such field per structure, so this commit reports an error if there is more than one.
- Loading branch information
Showing
3 changed files
with
154 additions
and
13 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