[BUG] scala-sttp string interpolation with backticks compiler error
Created by: novakov-alexey-zz
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? - [ 5.0.0-beta] What's the version of OpenAPI Generator used?
-
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
If REST API method parameter is called type
with backticks, then Scala compiler fails with:
nifi-client/target/generated-sources/openapi/src/gen/scala/main/org/openapitools/client/api/FlowApi.scala:569: error: invalid string interpolation $`, expected: $$, $identifier or ${expression}
[ERROR] .method(Method.GET, uri"$baseUrl/flow/processor-types?bundleGroupFilter=$bundleGroupFilter&bundleArtifactFilter=$bundleArtifactFilter&type=$`type`")
Example is taken from NiFi REST API: https://nifi.apache.org/docs/nifi-docs/rest-api/index.html
Expected behavior: code compiles without an y error.
openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
mvn clean install
Steps to reproduce
- Use Maven plugin:
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.0.0-beta</version>
- Specify generator as:
<generatorName>scala-sttp</generatorName>
- Specify NiFi swagger JSON file
- Run
mvn clean install
Related issues/PRs
Suggest a fix
Possible solution: wrap Scala keyword like name, i.e. type
with curly braces. i.e. generated string must be like this:
.method(Method.GET, uri"$baseUrl/flow/processor-types?bundleGroupFilter=$bundleGroupFilter&bundleArtifactFilter=$bundleArtifactFilter&type=${`type`}")
CC @ghostbuster91