mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-25 15:07:56 +00:00
Implemented disallow_unknown
* Added codegen for disallow_unknown * ... with new default to ignore unknown values during deserialization * Added ContainerAttrs
This commit is contained in:
@@ -585,6 +585,8 @@ Annotations
|
||||
`serde_codegen` and `serde_macros` support annotations that help to customize
|
||||
how types are serialized. Here are the supported annotations:
|
||||
|
||||
Field Annotations:
|
||||
|
||||
| Annotation | Function |
|
||||
| ---------- | -------- |
|
||||
| `#[serde(rename(json="name1", xml="name2"))` | Serialize this field with the given name for the given formats |
|
||||
@@ -594,6 +596,13 @@ how types are serialized. Here are the supported annotations:
|
||||
| `#[serde(skip_serializing_if_empty)` | Do not serialize this value if `$value.is_empty()` is `true` |
|
||||
| `#[serde(skip_serializing_if_none)` | Do not serialize this value if `$value.is_none()` is `true` |
|
||||
|
||||
Structure Annotations:
|
||||
|
||||
| Annotation | Function |
|
||||
| ---------- | -------- |
|
||||
| `#[serde(disallow_unknown)` | Always error during serialization when encountering unknown fields. When absent, unknown fields are ignored for self-describing formats like JSON. |
|
||||
|
||||
|
||||
Serialization Formats Using Serde
|
||||
=================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user