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

[C][Client] Add C++ reserved keywords to C-libcurl client generator #8205

Merged
merged 2 commits into from
Jan 5, 2021
Merged

Conversation

NickPak
Copy link
Contributor

@NickPak NickPak commented Dec 16, 2020

Add C++ reserved keywords to C-libcurl client generator, then the C client can be compiled by C++ compiler

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • If contributing template-only or documentation-only changes which will change sample output, build the project beforehand.
  • Run the shell script ./bin/generate-samples.shto update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

@ityuhui
Copy link
Contributor

ityuhui commented Dec 16, 2020

Hi @NickPak

Thank you for this PR !

Could you please update the title ? e.g.
"[C][Client] Add C++ reserved keywords to C-libcurl client generator, then the C client can be compiled by C++ compiler"

And could you please complete the PR checklist above?

This PR acutally is targeting the C programming language, so I copied
@zhemant @ityuhui @michelealbano to review

@NickPak
Copy link
Contributor Author

NickPak commented Dec 17, 2020

@ityuhui
I'm afraid that I can't. I'm not good at Java.

@ityuhui
Copy link
Contributor

ityuhui commented Dec 17, 2020

OK. I can help you for the sample generating.
You only need complete other PR Checklist, they do not need Java skill.
Especially update the title of your PR

@NickPak NickPak changed the title add cpp reserved keywords [C][Client] Add C++ reserved keywords to C-libcurl client generator, then the C client can be compiled by C++ compiler Dec 17, 2020
@NickPak
Copy link
Contributor Author

NickPak commented Dec 17, 2020

This is the error log. I don't know what to do.

Running node 1 to test 'samples.circleci' defined in pom.xml ...
openjdk version "1.8.0_141"
OpenJDK Runtime Environment (build 1.8.0_141-8u141-b15-3~14.04-b15)
OpenJDK 64-Bit Server VM (build 25.141-b15, mixed mode)
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test6454791523023565126/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test954083741941731665/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.languages.AbstractJavaCodegen - `null` (map property) does not have a proper inner type defined. Default to type:string
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test3264432509103891734/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test4677853923539687064/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultCodegen - Undefined array inner type for `null`. Default to String.
/tmp/test7993577064460177312/src/gen/java/org/openapitools/api/SomethingApi.java
/tmp/test7993577064460177312/README.md
/tmp/test7993577064460177312/pom.xml
/tmp/test7993577064460177312/src/gen/java/org/openapitools/api/RestApplication.java
/tmp/test7993577064460177312/openapi.yml
/tmp/test7993577064460177312/.openapi-generator-ignore
/tmp/test7993577064460177312/.openapi-generator/VERSION
/tmp/test7993577064460177312/.openapi-generator/FILES
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test2160243976201323106/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test1471858359763025896/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultCodegen - ERROR! Not handling  class QueryParameter {
    class Parameter {
        name: limit
        in: null
        description: this is a description
        required: true
        deprecated: null
        allowEmptyValue: null
        style: null
        explode: null
        allowReserved: null
        schema: null
        examples: null
        example: null
        content: null
        $ref: null
    }
    in: query
} as Body Parameter at the moment
[main] ERROR org.openapitools.codegen.DefaultCodegen - Undefined array inner type for `null`. Default to String.
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test3376975569732272992/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test4102735174135555307/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.languages.AbstractJavaCodegen - `null` (map property) does not have a proper inner type defined. Default to type:string
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test1722307535664264580/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test4668755578117868694/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test8844845452687673226/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

w /tmp/test8909219912129605984/.openapi-generator/VERSION


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultCodegen - body in fromRequestBody cannot be null!
[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

k /tmp/test824262524585330262/docs/PingApi.md
k /tmp/test824262524585330262/src/test/java/org/openapitools/client/api/PingApiTest.java


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

k /tmp/test1824485362833833697/docs/SomeObj.md
k /tmp/test1824485362833833697/src/test/java/org/openapitools/client/model/SomeObjTest.java


States:

  - w Write
  - n Write if New/Updated
  - i Ignored
  - s Skipped Overwrite
  - k Skipped by user option(s)
  - e Error evaluating file write state


[main] ERROR org.openapitools.codegen.DefaultGenerator - 

Dry Run Results:

k /tmp/test8190204586369016191/.openapi-generator-ignore
w /tmp/test8190204586369016191/.openapi-generator/VERSION
k /tmp/test8190204586369016191/README.md
k /tmp/test8190204586369016191/api/openapi.yaml
k /tmp/test8190204586369016191/build.gradle
k /tmp/test8190204586369016191/build.sbt
k /tmp/test8190204586369016191/gradle.properties
k /tmp/test8190204586369016191/gradle/wrapper/gradle-wrapper.jar
k /tmp/test8190204586369016191/gradle/wrapper/gradle-wrapper.properties
k /tmp/test8190204586369016191/gradlew
k /tmp/test8190204586369016191/gradlew.bat
k /tmp/test8190204586369016191/settings.gradle
k /tmp/test8190204586369016191/src/main/AndroidManifest.xml
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ApiCallback.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ApiClient.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ApiException.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ApiResponse.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/Configuration.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/GzipRequestInterceptor.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/JSON.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/Pair.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ProgressRequestBody.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ProgressResponseBody.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ServerConfiguration.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/ServerVariable.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/StringUtil.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/auth/Authentication.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
k /tmp/test8190204586369016191/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
....

https://circleci.com/api/v1.1/project/github/OpenAPITools/openapi-generator/21073/output/115/1?file=true&allocation-id=5fd9c99b9321fb6a5bbb0f50-1-build%2F7ADF7FCE

@ityuhui
Copy link
Contributor

ityuhui commented Dec 17, 2020

Do you mean the error log of the automatical check on this PR change? Do not worry about this, it's not the fault of your PR.
I will review your code change and try to generate the sample sometimes later.

@NickPak NickPak closed this Dec 17, 2020
@NickPak NickPak reopened this Dec 17, 2020
@ityuhui
Copy link
Contributor

ityuhui commented Dec 17, 2020

The code change looks good to me.

And I also re-generated the petstore sample, no file changed. I think this PR can be merged now.

BTW: This PR will introduce a defect that if a parameter in url path is a C++ keyword, it will be escaped, e.g.
sprintf(localVarToReplace_namespace, "{%s}", "namespace"); will change to
sprintf(localVarToReplace_namespace, "{%s}", "_namespace"); This is not a right behaviour.

I will create another PR to fix this issue.

@ityuhui
Copy link
Contributor

ityuhui commented Dec 23, 2020

Hi @wing328

This PR is ready to merge.

@wing328
Copy link
Member

wing328 commented Jan 5, 2021

Pushed 2771642 to fix the CI failure. Let's see how that goes.

@wing328
Copy link
Member

wing328 commented Jan 5, 2021

Travis CI tests passed via https://travis-ci.org/github/OpenAPITools/openapi-generator/builds/752935984?utm_medium=notification&utm_source=email

@wing328 wing328 merged commit 72869d5 into OpenAPITools:master Jan 5, 2021
@wing328 wing328 changed the title [C][Client] Add C++ reserved keywords to C-libcurl client generator, then the C client can be compiled by C++ compiler [C][Client] Add C++ reserved keywords to C-libcurl client generator Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants