salvo-rs / salvo

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

Derive `ToSchema` not work for unit enum variants #874

Closed cryscan closed 1 month ago

cryscan commented 1 month ago

This code no longer compiles upgrading from v0.69.0 to v0.71.0:

use serde::{Deserialize, Serialize};
use salvo::oapi::ToSchema;

#[derive(Debug, Default, Clone, Serialize, Deserialize, ToSchema)]
#[serde(untagged)]
pub enum Array<T> {
    #[default]
    None,    // Error: unit variant `Null` is not publicly re-exported
    Item(T),
    Vec(Vec<T>),
}

57c932e1580013cd693e85c1d2516720