Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6883
Closed
Open
Issue created Jul 07, 2020 by Administrator@rootContributor3 of 5 checklist items completed3/5 checklist items

[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
  1. Use Maven plugin:
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.0.0-beta</version>
  1. Specify generator as:
<generatorName>scala-sttp</generatorName>
  1. Specify NiFi swagger JSON file
  2. 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

Assignee
Assign to
Time tracking