Skip to content

Enum in header is not transmitted to schemas #1324

@Decarp

Description

@Decarp

When I add an enum only in the header, it gets referenced in the yaml output, but there is no corresponding schema in the yaml schema definitions. When I additionally add the enum to a body, it appears in the schema definitions and works as expected.

yaml:

 "schema": {
      "$ref": "#/components/schemas/AnalysisType" // missing in schema definitions
 }
#[derive(Deserialize, Serialize, Debug, ToSchema)]
pub enum AnalysisType {
    Spending,
    Nutrition,
}

#[utoipa::path(
    get,
    path = "/analysis",
    params(
        ("Analysis-Type" = AnalysisType, Header, description = "Type of analysis to be performed. Either 'Spending' or 'Nutrition'")),
)]
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions