Update docs
This commit is contained in:
parent
cb26e783dc
commit
93435d519a
5 changed files with 23 additions and 5 deletions
|
@ -1,13 +1,14 @@
|
|||
---
|
||||
layout: default
|
||||
title: Serialize enum as number (serde_repr)
|
||||
title: Serialize Enum as Number (serde_repr)
|
||||
parent: Examples
|
||||
nav_order: 8
|
||||
summary: >-
|
||||
Generating a schema for with a C-like enum compatible with serde_repr.
|
||||
nav_exclude: true # schemars 0.8.2 currently unreleased
|
||||
---
|
||||
|
||||
# Deriving JsonSchema with Fields Using Custom Serialization
|
||||
# Serialize Enum as Number (serde_repr Compatibility)
|
||||
|
||||
If you use the `#[repr(...)]` attribute on an enum to give it a C-like representation, then you may also want to use the [serde_repr](https://github.com/dtolnay/serde-repr) crate to serialize the enum values as numbers. In this case, you should use the corresponding `JsonSchema_repr` derive to ensure the schema for your type reflects how serde formats your type.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue