Adyen / adyen-openapi

OpenAPI specification for the Adyen APIs
MIT License
67 stars 50 forks source link

Nullability lost when generating client using NSwag generator #52

Closed dennishog closed 7 months ago

dennishog commented 7 months ago

Describe the bug When using vs2022 and connected service for the checkoutservice v71 openapi spec NSwag generator doesn't work correctly with nullability if not 'nullable: true' is present on the property. I have had to manually change properties after my requirements to handle this. For instance in the /sessions endpoint (CreateCheckoutSessionRequest) I had to add 'nullable: true' to storePaymentMethod, enableRecurring, enableOneClick, expiresAt to be able to use the client without having a session causing error with payment.

To Reproduce Steps to reproduce the behavior:

  1. Download checkoutservice v71 yaml add add to folder in assembly
  2. Add connectedservice using the yaml (with option GenerateNullableReferenceTypes:true present)
  3. The generated client have bool instead of bool? for instance

Expected behavior Expecting nullable properties to be reflected correctly in the generated client

Screenshots Need to add this to all properties if possible image

dennishog commented 7 months ago

My bad :-) NSwag generator has an option that I missed "/GenerateOptionalPropertiesAsNullable:true" that solves this issue