poem_openapi

Derive Macro Enum

Source
#[derive(Enum)]
{
    // Attributes available to this derive:
    #[oai]
}
Expand description

Define an OpenAPI enum

§Macro parameters

AttributeDescriptionTypeOptional
renameRename the enumstringY
rename_allRename all the items according to the given case convention. The possible values are “lowercase”, “UPPERCASE”, “PascalCase”, “camelCase”, “snake_case”, “SCREAMING_SNAKE_CASE”, “kebab-case”, “SCREAMING-KEBAB-CASE”.stringY
deprecatedSchema deprecatedboolY
external_docsSpecify a external resource for extended documentationstringY
remoteDerive a remote enumstringY

§Item parameters

AttributeDescriptionTypeOptional
renameRename the itemstringY

§Examples

use poem_openapi::Enum;

#[derive(Enum)]
enum PetStatus {
    Available,
    Pending,
    Sold,
}