Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp-qt5] Escape language reserved symbols which are valid in the spec #281

Closed
etherealjoy opened this issue Jun 11, 2018 · 2 comments
Closed

Comments

@etherealjoy
Copy link
Contributor

etherealjoy commented Jun 11, 2018

Description

When the specification contains valid symbols which are language specific operators compilation fails.

openapi-generator version

3.0.0

OpenAPI declaration file content or url

This is a valid snippet from a spec

  v1.HostPathType:
    type: object
    additionalProperties:
      type: string

Creates the following snippet of code for Qt5 for example

class OAIV1.HostPathType: public OAIObject {

This code will not compile for any C++ client and server.
I would suppose the same issue for other langs like C#

Suggest a fix/enhancement

The '.' and other valid symbols for example has to be escaped for example to '_' to make compilation pass.

@etherealjoy etherealjoy changed the title [C++] Escape language reserved symbols which are valid in the spec [DefaultCodegen] Escape language reserved symbols which are valid in the spec Jun 11, 2018
@etherealjoy
Copy link
Contributor Author

etherealjoy commented Jun 11, 2018

Following code in DefaultCodegen.java is not working for this case

public String sanitizeName(String name, String removeCharRegEx)
...
        // input.name => input_name
        name = name.replaceAll("\\.", "_");

@etherealjoy etherealjoy changed the title [DefaultCodegen] Escape language reserved symbols which are valid in the spec [cpp-qt5] Escape language reserved symbols which are valid in the spec Jun 24, 2018
@etherealjoy
Copy link
Contributor Author

Solved in #388

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant