-
Notifications
You must be signed in to change notification settings - Fork 198
Description
Describe the issue
According to the documentation, only Required.Always
and Required.DisallowNull
in a JsonProperty
attribute will mark a property as required in the schema.
Required.AllowNull
should also mark it as required. The documentation states: "The property must be defined in JSON but can be a null value." It must be present in the JSON, therefore it must be marked as required.
Required.DisallowNull
should not mark it as required. The documentation states: "The property is not required but it cannot be a null value." It may be present in the JSON, therefore it should not be marked as required.
To Reproduce
See this demonstration project: https://github.com/basilfx/azure-functions-openapi-function-timespan (yes, same project as #401).
Note how MyInstance.MyNullableTimeSpan
has Required = Required.AllowNull
, yet it is not marked as required in the schema. As a work-around, add the Required
attribute.
Expected behavior
The property is marked as required in the inferred schema.
Environment (please complete the following information, if applicable):
- OS: macOS
- Azure Functions v4
- .NET SDK 6.0.102
- OpenAPI Extension 1.2.0