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
I'd like to be able to include extra validation beyond what's supported by OpenAPI/#[oai(validator)] as part of ParseFromJSON so that I can be sure validation always runs on received data.
I can see a few ways it could be implemented, including allowing mutation of the parsed object.
#[derive(poem_openapi::Object)]#[oai(finalize = finalize_foo)]structFoo{#[oai(validator(unique_items = true))]sorted:Vec<usize>,}// Alternatively, a signature of fn(Foo) -> ParseResult<Foo>fnfinalize_foo(parsed:&Foo) -> poem_openapi::types::ParseResult<()>{if !parsed.sorted.is_sorted(){returnErr(ParseError::custom("`sorted` must be sorted"));}Ok(())}
I'm open to providing a PR for this if the feature would be accepted.
The text was updated successfully, but these errors were encountered:
Description of the feature
I'd like to be able to include extra validation beyond what's supported by OpenAPI/
#[oai(validator)]
as part ofParseFromJSON
so that I can be sure validation always runs on received data.I can see a few ways it could be implemented, including allowing mutation of the parsed object.
See also related issues in
serde
:Code example (if possible)
I'm open to providing a PR for this if the feature would be accepted.
The text was updated successfully, but these errors were encountered: