Fix nullable property deserialization in OpenAPI v3 provider #287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OpenAPI 3.0 properties marked
nullable: truewere generating non-nullable F# types, causingSystem.Text.Json.JsonExceptionat runtime when deserializing null values.Changes
isSchemaNullablehelper to detectJsonSchemaType.Nullflag (how Microsoft.OpenApi v2.4.1 represents OpenAPI 3.0'snullable: true)Option<T>regardless ofrequiredstatusImplementation
The fix treats properties as optional when either not required OR nullable:
This correctly handles all OpenAPI combinations:
required: true, nullable: true→Option<T>(present but can be null)required: true, nullable: false→T(present and non-null)required: false, nullable: *→Option<T>(can be absent)Test
Added schema
nullable-date.yamland test verifying nullable date fields generateOption<DateTimeOffset>types.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
petstore.swagger.io/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.102/FSharp/fsc.dll @/tmp/MSBuildTempfAICPP/tmp8a486eb65866450a9fd32f652001aa9b.rsp(dns block)/usr/share/dotnet/dotnet /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/10.0.102/FSharp/fsc.dll @/tmp/MSBuildTempWPH3E8/tmpd9bb636ed2714511bacccb5154efa42e.rsp k/SwaggerProvider/SwaggerProvidesrc/SwaggerProvider.DesignTime/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs Shar�� 8f39f2440a5a1cf887f1d8747e7.rsp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.