harness / ff-dotnet-server-sdk

.net Server SDK for integrating with Harness Feature Flag service.
https://harness.io/
Apache License 2.0
5 stars 10 forks source link

FFM-9221 - Update to latest OpenAPI spec + improve handling of null items defined as optional #75

Closed andybharness closed 1 year ago

andybharness commented 1 year ago

FFM-9221 - Update to latest OpenAPI spec + improve handling of null items defined as optional

What Update client API definitions and use a more recent version of NSwag. Add a new JSON ContractResolver to change Required.DisallowNull to Required.Default.

Why API definitions are a couple years out of date. Currently client-v1.yaml does not require certain attributes however the code generator still adds Newtonsoft.Json.Required.DisallowNull which will throw an exception if the property is present but null. There does not seem to be any way to configuring the generator to remove the DisallowNull at code generation time, so instead we do it dynamically with a new class that is set Required.Default where needed.

This fixes the problem identified in https://github.com/harness/ff-proxy/pull/61

Testing Manual + testgrid