You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Either way, the user of my API sees string | null | undefined, which is not the case: my API will always return the property (I do not use #[serde(skip_serializing_if = "Option::is_none")] or similar).
The behavior should be configurable. If you're ingesting stuff, you might want to be loose. But if you're documenting your own API, you might want to be specific (Robustness principle).
The text was updated successfully, but these errors were encountered:
This is a special case of #48 - the generated schema currently describes the deserialization contract (where the property may be null or omitted), but you want the serialization contract (where the property will never be omitted)
(cf. Issue #11: Option<bool> gets required in schema)
Type:
gets written into a schema as not required.
When generating a TypeScript type for this, you (correctly) get:
Either way, the user of my API sees
string | null | undefined
, which is not the case: my API will always return the property (I do not use#[serde(skip_serializing_if = "Option::is_none")]
or similar).The behavior should be configurable. If you're ingesting stuff, you might want to be loose. But if you're documenting your own API, you might want to be specific (Robustness principle).
The text was updated successfully, but these errors were encountered: