Azure / Azure/azure-functions-openapi-extension

Is it possible to add documentation to enums?

Open
#446 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**

When your endpoint returns a model containing an enum, there is no way (that I know of) to add a descriptive text to each possible enum value. The ` [OpenApiProperty]` attribute doesn't work on enums. Maybe this is not possible in C# for technical reasons, but there is support for it in the [swagger spec](https://swagger.io/docs/specification/data-models/enums/) afaik

```
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum Status
{
[OpenApiProperty(Description = "This invoice is paid")] // <-- does not work.
Paid,
Unpaid,
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.