From 93435d519a3a8c8b0777f3ad3e325f2821814bdb Mon Sep 17 00:00:00 2001 From: Graham Esau Date: Thu, 25 Mar 2021 22:51:51 +0000 Subject: [PATCH] Update docs --- README.md | 2 +- docs/3-generating.md | 2 +- docs/examples/8-enum_repr.md | 5 +++-- docs/examples/9-from_value.md | 17 +++++++++++++++++ schemars/src/lib.rs | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 docs/examples/9-from_value.md diff --git a/README.md b/README.md index d2b97ff..be80bb4 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ println!("{}", serde_json::to_string_pretty(&schema).unwrap()); `#[serde(...)]` attributes can be overriden using `#[schemars(...)]` attributes, which behave identically (e.g. `#[schemars(rename_all = "camelCase")]`). You may find this useful if you want to change the generated schema without affecting Serde's behaviour, or if you're just not using Serde. -### Schema from Example Values +### Schema from Example Value If you want a schema for a type that can't/doesn't implement `JsonSchema`, but does implement `serde::Serialize`, then you can generate a JSON schema from a value of that type. However, this schema will generally be less precise than if the type implemented `JsonSchema` - particularly when it involves enums, since schemars will not make any assumptions about the structure of an enum based on a single variant. diff --git a/docs/3-generating.md b/docs/3-generating.md index cc65004..e9cf09e 100644 --- a/docs/3-generating.md +++ b/docs/3-generating.md @@ -21,7 +21,7 @@ If you want more control over how the schema is generated, you can use the [`gen See the API documentation for more info on how to use those types for custom schema generation.