GREsau / okapi

OpenAPI (AKA Swagger) document generation for Rust projects
MIT License
578 stars 103 forks source link

[FEATURE]: Support for Validated<T> implementation . #142

Closed saeedtabrizi closed 3 months ago

saeedtabrizi commented 4 months ago

Hi all , Recently I had an issue with okapi integration with rocket_validation Validated . Is there any plan to implement Validated struct ? on the other please let me have a workaround to support validation in my project .

Thanks

saeedtabrizi commented 4 months ago

When I try to implement this method in my project

impl<'r, T: JsonSchema + Deserialize<'r>> OpenApiFromData<'r> for Validated<T> {
    fn request_body(gen: &mut OpenApiGenerator)  {
        Json::request_body(gen)
    }
}

I see the following error : only traits defined in the current crate can be implemented for types defined outside of the crate define and implement a trait or new type insteadrustc sample.rs(26, 67):Validatedis not defined in the current crate what should I do to and is there any workaround to solve this issue ?

ralpha commented 3 months ago

See my comment on #143