Closed saurabhnanda closed 2 years ago
Hi @saurabhnanda ,
To answer your original question: No, this parameter is not ignored based on its name (you should be able to use any Haskell keyword, feel free to open an issue if not).
But you have discovered a different problem which results from the combination of an optional parameter and an enum with only one element. As OpenAPI 3 has no other option to describe a constant value, some specifications (including Stripe which is the main specification this generator is currently used for) define enum values with only one element to effectively create a constant value in a type. To ease the use of those constants the corresponding fields are left out from the generation (but is included in the serialisation) as the only valid value is already known. But for optional fields this behaviour is of course not applicable as there are effectively two valid values.
I created this PR to fix it: https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator/pull/58
Side note: The OpenAPI specification you sent seems strange to me regarding the type parameter as the only allowed value is "spread"
but the description states that it can be used multiple times (which seems a bit silly if really only one value is allowed).
Hi @saurabhnanda,
Did the PR fix your problem and can we close this issue?
I close this issue as I believe it is fixed, please let me know if this is still a problem.
Referring to https://docs.hetzner.cloud/spec.json it seems that
GET /placement_groups
accepts a query-param called "type", which results in the following error when the generated code is compiled:It seems that the other three query params are there, but the
type
query-param has been silently skipped:I'm presuming this is because
type
is a reserved keyword in Haskell. Would it be possible to make a special case for this because this is so common in APIs? Implicitly rename it totyp
ortype_
?