[Elm] [BUG] Enum paramters not working if not inlined ($ref)
Created by: andys8
Description
Using string enums as url parameters is working, if they're defined inline per path. If a single enum definition should be used for multiple paths as parameter and referenced with $ref
, it won't be recognized as being an enum.
Parameter 'flow' cannot be converted to a string. Please report the issue.
For comparison: A parameter reference to an enum seems to be working for java.
openapi-generator version
4.1.2
OpenAPI declaration file content or url
/conversation/{flow}:
post:
summary: Create dental supplementary conversation
operationId: createConversation
tags:
- conversation
parameters:
- name: flow
in: path
required: true
schema:
$ref: '#/components/schemas/FlowType'
responses:
"201":
description: Current conversation
content:
application/json:
schema:
$ref: "#/components/schemas/Conversation"
FlowType:
type: string
enum:
- MyValue
- MyOtherValue
Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Conversation'
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:668)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:924)
at org.openapitools.codegen.cmd.Generate.run(Generate.java:408)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:60)
Caused by: java.lang.RuntimeException: Parameter 'flow' cannot be converted to a string. Please report the issue.
at org.openapitools.codegen.languages.ElmClientCodegen.paramToStringMapper(ElmClientCodegen.java:593)
at org.openapitools.codegen.languages.ElmClientCodegen.paramToString(ElmClientCodegen.java:621)
at org.openapitools.codegen.languages.ElmClientCodegen.postProcessOperationsWithModels(ElmClientCodegen.java:453)
at org.openapitools.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:1178)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:553)
... 3 more
Related issues/PRs
Related to #2585 (closed) and #2982 (great work! @eriktim )
Suggest a fix
My understanding is that a $ref
to a schema definition (which is an enum) is not recognized as enum. There has to be a recursive test looking up the parameter.
@eriktim