salvo-rs / salvo

A powerful web framework built with a simplified design.
https://salvo.rs
Apache License 2.0
3.31k stars 201 forks source link

`required` attribute for salvo_oapi endpoint macro #792

Closed YorKnEz closed 4 months ago

YorKnEz commented 4 months ago

According to docs of params_attributes, there is no way of setting the required flag of a query param off. I would like an attribute that does that.

For example, I want to be able to say:

#[endpoint(parameters(("test" = String, Query, required = false)))]
chrislearn commented 4 months ago

Use Option<String>.

#[endpoint(parameters(("test" = Option<String>, Query, )))]
YorKnEz commented 4 months ago

How did I not think of that.. thank you very much