Add separate docs for v0.8/v1

This commit is contained in:
Graham Esau 2024-06-09 19:01:24 +01:00
parent 3150f98fc8
commit d511d447f7
61 changed files with 1620 additions and 58 deletions

View file

@ -0,0 +1,13 @@
---
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.
---
# 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.
{% include example_v0.md name="enum_repr" %}