Closed s9gf4ult closed 2 years ago
@s9gf4ult I have no opinion on this per-se, but are we sure that null
and "missing key" are semantically equal?
@NorfairKing They are not. That is the point. If you have schema like this
Delay:
description: "response delay"
type: object
additionalProperties: false
properties:
timeUnit:
type: string
value:
type: integer
the object {value: 10}
will follow the schema, but {timeUnit: null, value: 10}
will not (because null
is not a string
, appearantly). But actually it depends on schema validator. The validator form mock-server
does not allow the former.
Thank you for the PR @s9gf4ult! I like this change as this is definitely closer to the OpenAPI spec than before. Would you mind update the golden tests and fix the broken level 2 tests in .circleci/testing/level2/petstore-running-example/test/Spec.hs
? If you need help to do this, please shout.
Sure, will do in few days
Hey @s9gf4ult, are you okay to close this PR in favor of https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/pull/75? It includes your changes but extends them for deserialization and nullable support with tests. Thank you for your input, it was valuable!
@joelfisch sure. Your request works just fine. Thanks.
The idea behind this PR is that instead of generating
null
values forNothing
values on optional fields of JSON-objects we do not add the these fields at all.