Update docs and changelog
This commit is contained in:
parent
bfb3f06253
commit
e7cae04beb
12 changed files with 25 additions and 6 deletions
|
@ -124,6 +124,15 @@ If the given type has any required generic type parameters, then they must all b
|
|||
|
||||
Serde docs: [variant](https://serde.rs/variant-attrs.html#with) / [field](https://serde.rs/field-attrs.html#with)
|
||||
|
||||
<h3 id="deny_unknown_fields">
|
||||
|
||||
`#[serde(deny_unknown_fields)]` / `#[schemars(deny_unknown_fields)]`
|
||||
</h3>
|
||||
|
||||
Setting this on a container will set the `additionalProperties` keyword on generated schemas to `false` to show that any extra properties are explicitly disallowed.
|
||||
|
||||
Serde docs: [container](https://serde.rs/container-attrs.html#deny_unknown_fields)
|
||||
|
||||
</div>
|
||||
|
||||
## Other Attributes
|
||||
|
|
|
@ -2,7 +2,7 @@ use schemars::{schema_for, JsonSchema};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, JsonSchema)]
|
||||
#[schemars(rename_all = "camelCase")]
|
||||
#[schemars(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct MyStruct {
|
||||
#[serde(rename = "thisIsOverridden")]
|
||||
#[schemars(rename = "myNumber")]
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"MyEnum": {
|
||||
"anyOf": [
|
||||
|
|
|
@ -2,7 +2,7 @@ use schemars::{schema_for, JsonSchema};
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Serialize, JsonSchema)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||
pub struct MyStruct {
|
||||
#[serde(rename = "myNumber")]
|
||||
pub my_int: i32,
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
"format": "int32"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"definitions": {
|
||||
"MyEnum": {
|
||||
"anyOf": [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue