swagger-api / swagger-api/swagger-codegen

[CPPREST] Generated code does not compile because of bad characters: {}.[]

Open
#10,373 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Swagger schema contains definitions like "Org.Forms.{location}.Connect.ProjectSettings". Generated code for such schema contains classes like "class Instance[Org.Forms.{location}.Connect.ProjectSettings]". This is not valid c++ and it does not compile. Is this a bug? Does workaround exist?

Swagger-codegen version

2.4.14

Swagger declaration file content or url

https://www.dropbox.com/s/gec7tj59fuzi44h/bad_swagger_schema.json?dl=1

Command line used for generation

java -jar .\swagger-codegen-cli.jar generate -l cpprest -i .\bad_swagger_schema.json -o .

Steps to reproduce
  1. Copy schema to c:\test\bad_swagger_schema.json
  2. Open powershell and go to c:\test
  3. Run
    java -jar .\swagger-codegen-cli.jar generate -l cpprest -i .\bad_swagger_schema.json -o .
Related issues

https://github.com/swagger-api/swagger-codegen/issues/8460

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by downloading bad_swagger_schema.json and running the documented Java swagger-codegen command with the cpprest generator. Inspect the generated C++ declarations containing Org.Forms.{location}.Connect.ProjectSettings and the cpprest generator templates or naming entry points that produced them. Done means the generated C++ compiles without invalid characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.