When using Nswag.AspNetcore setting configure.RequireParametersWithoutDefault = true; on an OpenApiDocument, all parameters defined within classes are required.
On lines 79-87, if the apiParameter has ModelMetadata and the PropertyName exists on the container type, the property variable is set and assigned to the extendedApiParameter.PropertyInfo. This also causes the extendedApiParameter.ParameterInfo property to never be set (line 96 is the only place the property is set).
This means when ExtendedApiParameterDescription.IsRequired is called, at the end (line 553) requireParametersWithoutDefault && ParameterInfo?.HasDefaultValue != true is always true because ParameterInfo is always null
When using Nswag.AspNetcore setting
configure.RequireParametersWithoutDefault = true;
on an OpenApiDocument, all parameters defined within classes are required.I've determined that this is because of the OperationParameterProcessor class.
On lines 79-87, if the apiParameter has ModelMetadata and the PropertyName exists on the container type, the property variable is set and assigned to the![image](https://github.com/RicoSuter/NSwag/assets/14329386/743411d6-9dfb-4bc2-8045-70bf00a27595)
extendedApiParameter.PropertyInfo
. This also causes theextendedApiParameter.ParameterInfo
property to never be set (line 96 is the only place the property is set).This means when![image](https://github.com/RicoSuter/NSwag/assets/14329386/cba0636b-bb2f-4548-abfe-e62a2d4bd082)
ExtendedApiParameterDescription.IsRequired
is called, at the end (line 553)requireParametersWithoutDefault && ParameterInfo?.HasDefaultValue != true
is always true becauseParameterInfo
is alwaysnull