paperclip-rs / paperclip

WIP OpenAPI tooling for Rust.
Apache License 2.0
892 stars 117 forks source link

Is there a way to not skip Enum(Struct) or Enum(Enum)? #537

Open RaulTrombin opened 1 month ago

RaulTrombin commented 1 month ago

Currently paperclip skips the Enum{ Something ( something_else ) } fields.

Is there a way to make the inner structure shows as a parameter? example

 #[derive(Debug, Clone, Serialize, Deserialize, Apiv2Schema)]
pub enum DeviceManagerGetOptionsV1 {
    AutoCreate,
    List,
    Search,
    Request(some structure)
}

 #[api_v2_operation(tags("Device Manager"))]
#[get("device_manager/{selection}")]
async fn device_manager_get(
    manager_handler: web::Data<ManagerActorHandler>,
    selection: web::Path<DeviceManagerGetOptionsV1>,
) -> Result<Json<crate::device::manager::Answer>, Error> {
.....
}

Then, APIspec only shows the simple enums. Is there a way to how the 'Request', and if it's selected, shows the strcuture field?

tiagolobocastro commented 1 month ago

s there a way to how the 'Request', and if it's selected, shows the strcuture field?

What do you mean by "show the structure field" ?

RaulTrombin commented 1 month ago

s there a way to how the 'Request', and if it's selected, shows the strcuture field?

What do you mean by "show the structure field" ?

to not skip it, make the enum route avaiable alongside with simple enums and make inner field avaiable as a parameter when we load the api spec on swager

tiagolobocastro commented 3 weeks ago

On your enum, is "some structure" data you'd expect as input? Or more slashes in the path? Can you share an example including the expected generated openapi code?