File: src/OpenApiSourceGenerator/Generators/PropertyGenerator.cs
Only the required OpenAPI keyword is mapped to the C# required modifier. Optional (non-required) reference-type properties (e.g. string, object references) are still emitted as non-nullable:
public class Pet
{
public string Name { get; set; } // optional in the spec, but not nullable in C#
}
If the consuming project has <Nullable>enable</Nullable>, this produces CS8618 warnings for every optional reference-type property.
Suggested fix: Emit string? (or the appropriate nullable annotation) for non-required reference-type properties, or otherwise ensure generated code doesn't trigger nullable-context warnings by default.
File:
src/OpenApiSourceGenerator/Generators/PropertyGenerator.csOnly the
requiredOpenAPI keyword is mapped to the C#requiredmodifier. Optional (non-required) reference-type properties (e.g.string, object references) are still emitted as non-nullable:If the consuming project has
<Nullable>enable</Nullable>, this producesCS8618warnings for every optional reference-type property.Suggested fix: Emit
string?(or the appropriate nullable annotation) for non-required reference-type properties, or otherwise ensure generated code doesn't trigger nullable-context warnings by default.