Azure / Azure/azure-functions-openapi-extension

Feaure: Make it possible to not have a default enum value and ignore a property

Open
#469 0 comments 3 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**
By default, when converting an enum, the first index will be considered as the default enum property. However, in some cases, the enum properties are optional meaning that there should not be a default value.
More over, while coding I noticed that I was looking for a way to customize what should be included in the OpenApi Spec, but did not succeed in my research - I have tried using the annotations [JsonIgnore] and [IgnoreDataMember], but that did not affect anything. I have read the [documentation](https://github.com/Azure/azure-functions-openapi-extension/blob/main/docs/openapi-core.md#displayattribute) about how to show the string value of the enum properties, but unfortunately, it does always include everything and it is (seemingly) not possible to handpick, which should not be included.

**To Reproduce**

**Expected behavior**
Data annotations that enables one to tell there is no default value and exclude some properties from the spec.

**Environment (please complete the following information, if applicable):**
- OS: Windows
- .Net version: 6

Contributor guide

Open the contributing guide

Research direction

Start with the openapi-core.md DisplayAttribute documentation linked in the issue, then trace how enum properties are converted into the OpenAPI spec. Define how annotations should express no default enum value and how selected properties should be excluded, and verify that both behaviors are reflected in the generated spec.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, openapi
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.