@kirdaybov The support for the Python is rather limited for now as I wasn't too sure what you'd like to generate.
@ereOn I had to compromise in Rust to find a type that could feat the "any" type. There are many constraints (Clone, Hash, Deserialize, PartialEq/Ord, etc...) and unfortunately a supertrait that'd require all the above constraints would not work (since Deserialize requires Self to be Sized). We could almost use serde_json::Value but it doesn't implement Hash (https://github.com/serde-rs/json/issues/720 and https://github.com/serde-rs/json/issues/747). So instead I created a new
JsonValue newtype that wraps serde_json::Value and implements Hash (it's fine except for null).
In the end of the day this pr fully supports the additionalProperties feature and not just some cases.
Here is what the codegen does when the value of
additionalProperties
istrue
- map string -> anyfalse
- nooptrue
+properties
is provided - struct + flatten__additional_properties
: map string -> anyfalse
+properties
is provided - same as without theadditionalProperties
option__additional_properties
: map string -> schema@kirdaybov The support for the Python is rather limited for now as I wasn't too sure what you'd like to generate.
@ereOn I had to compromise in Rust to find a type that could feat the "any" type. There are many constraints (Clone, Hash, Deserialize, PartialEq/Ord, etc...) and unfortunately a supertrait that'd require all the above constraints would not work (since Deserialize requires Self to be Sized). We could almost use
serde_json::Value
but it doesn't implement Hash (https://github.com/serde-rs/json/issues/720 and https://github.com/serde-rs/json/issues/747). So instead I created a newJsonValue
newtype that wrapsserde_json::Value
and implements Hash (it's fine except for null).What do you think?