Azure / Azure/azure-functions-openapi-extension

Is there another way to set Nullable=True on a field?

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

Description

We can add this attribute to a field, in order to set the Nullable=true in the swagger - but this assumes I have access to the source
[OpenApiProperty(Nullable = true, Default = 10, Description = "The number value")]

What if I dont have access to the source (e.g. I am referencing a 3rd party c# class)? Is there another way to set Nullable=true on the fields?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how the extension generates OpenAPI schemas and how nullable metadata is currently supplied through OpenApiProperty on model fields. The work is done when a third-party C# type can have its fields marked nullable without modifying its source, and the generated Swagger reflects Nullable=true.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.