[BUG] [haskell-http-client] Using a schema reference for an optional form parameter of a request body results in broken code
Created by: typetetris
Bug Report Checklist
-
Provided a broken spec. -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output?
Description
Using a schema reference for an optional form parameter of a request body results in broken code.
I expected compiling code.
openapi-generator version
From Commit 6c5621d9 (HEAD of master at the moment)
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: Example
description: Example to demonstrate issues with optional parameters for haskell-http-client
contact:
name: example
url: https://www.example.example
email: example@test.test
license:
name: whateveryouneed
url: https://www.example.example
version: 0.0.1
servers: []
paths:
/example:
post:
tags:
- example
description: Example
operationId: exampleOp
requestBody:
description: example
required: true
content:
'application/x-www-form-urlencoded':
schema:
type: object
properties:
example:
$ref: '#/components/schemas/Example'
responses:
'204':
description: Success
components:
schemas:
"Example":
title: ExampleEnum
type: string
enum:
- "Value1"
- "Value2"
- "Value3"
description: ''
Command line used for generation
openapi-generator-cli generate -o test -i example.yaml -g haskell-http-client
Steps to reproduce
cd test
cabal build
Related issues/PRs
none to my knowledge
Suggest a fix
pr incoming. There is a completely arbitrary if condition in the code, with no else branch and the else case leaves some vendor extensions thingies uninitialised.