Open wallagib opened 9 months ago
+1 to automatically set it to title=<enum name><enum value name>
pub enum Schedule {
#[schema(title = "ScheduleYearly")]
Yearly(YearlySchedule),
#[schema(title = "ScheduleMonthly")]
Monthly(MonthlySchedule),
#[schema(title = "ScheduleWeekly")]
Weekly(WeeklySchedule),
#[schema(title = "ScheduleDaily")]
Daily(DailySchedule),
/// execute once on the given date and then never again
#[schema(title = "ScheduleOnce")]
Once { date_time: NaiveDateTime },
}
I'm adding functionality to another code generator that consumes the OpenAPI spec, and I realized that it would be nice to propagate the enum names from Rust into other languages. I'm probably going to do this by pulling the
title
field if present.In my environment, I have a lot of enums and adding
schema(title="X")
for each variant just to have the same name is tedious. Is there any reason not to automatically settitle=<enum name>
automatically?EDIT: I'm not sure if/how this would work with the other serde enum tagging types.