Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
46 stars 19 forks source link

Nullable support #75

Closed joel-bach closed 2 years ago

joel-bach commented 2 years ago

This PR aims to fix https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/issues/55 and includes the changes from https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/pull/73 but extends those to include support for nullable and correct the behavior for deserialization as well.

Example of the newly generated nullable types:

data X = X {
  requiredAndNullable :: (OpenAPI.Common.Nullable GHC.Types.Int),
  optionalAndNullable :: (GHC.Maybe.Maybe (OpenAPI.Common.Nullable Data.Text.Internal.Text)),
  optionalAndNonNullable :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}