GREsau / schemars

Generate JSON Schema documents from Rust code
https://graham.cool/schemars/
MIT License
791 stars 220 forks source link

Propagate `additional_properties` when using `#[serde(flatten)]` #275

Open nightkr opened 5 months ago

nightkr commented 5 months ago

Fixes #259, motivated by https://github.com/stackabletech/operator-rs/pull/752

Whether None or Some(Schema::Object(...)) is more permissive is arguably a matter of perspective. If you consider the JSON Schema to be a a validation target then None could be argued to mean "and I don't care about anything else", while if it's a normative schema then None would mean "and nothing else is accepted".

Following the latter interpretation, any non-None schema would be more permissive than None.

I also believe that the expected behaviour is always that a "newtype" (a single flattened field) behaves identically to the type that it wraps, modulo explicitly requested differences.

nightkr commented 5 months ago

The MSRV check seems to be unrelated, and comes from https://github.com/rust-lang/cargo/issues/9930.

nightkr commented 5 months ago

RUSTC_BOOTSTRAP=1 cargo +1.60.0 test -Z minimal-versions passes locally for me.