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-Libcurl client: fix enum model generation #5604

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

Angeall
Copy link
Contributor

@Angeall Angeall commented Mar 16, 2020

Completes commit fc9d458

The "..._parseFromJSON" template was buggy because the name of the _e type used was not the same than the generated.
See the first argument of "..._convertToJSON" to see that the _e type used there was not the same

About #5477 (#5091 and #4293)

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.

The "..._parseFromJSON" template was buggy because the name of the _e type used was not the same than the generated.
See the first argument of "..._convertToJSON" to see that the _e type used there was not the same
@Angeall
Copy link
Contributor Author

Angeall commented Mar 16, 2020

As requested, tagging technical experts now:
@zhemant @ityuhui

@ityuhui
Copy link
Contributor

ityuhui commented Mar 17, 2020

Hello @Angeall @zhemant
I want to involve @michelealbano to discuss this PR because he is the author of #5477

@ityuhui
Copy link
Contributor

ityuhui commented Mar 19, 2020

Hello @michelealbano

Could you please take a look at this PR because it may involve your PR #5477 ?

@ityuhui
Copy link
Contributor

ityuhui commented Mar 21, 2020

Hi @Angeall

Could you please execute ./bin/c-petstore.sh to regenerate the sample petstore and push them to this PR for reivew because it is required by RP checklist .

@Angeall
Copy link
Contributor Author

Angeall commented Mar 23, 2020

Hi @Angeall

Could you please execute ./bin/c-petstore.sh to regenerate the sample petstore and push them to this PR for reivew because it is required by RP checklist .

I did, but it does not generate any change in git 😮 .
Here is the output of the script :

# START SCRIPT: ./bin/c-petstore.sh
[main] INFO  o.o.codegen.DefaultGenerator - Generating with dryRun=false
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: c (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'c' is considered stable.
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
michele was here preprocessOpenAPI openapi_petstore
michele was here preprocessOpenAPI after openapi_petstore
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/api_response.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/api_response.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/category.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/category.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/order.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/order.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/pet.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/pet.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/tag.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/tag.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/user.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/user.c
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN  o.o.codegen.DefaultCodegen - Multiple MediaTypes found, using only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/json)
[main] WARN  o.o.codegen.DefaultCodegen - Multiple MediaTypes found, using only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in the OAS 'content' section, returning only the first one (application/xml)
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/PetAPI.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/PetAPI.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/StoreAPI.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/StoreAPI.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/UserAPI.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/api/UserAPI.h
[main] INFO  o.o.codegen.DefaultGenerator - Skipped generation of /tmp/openapi-generator/samples/client/petstore/c/CMakeLists.txt due to rule in .openapi-generator-ignore
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/libcurl.licence
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/uncrustify-rules.cfg
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/README.md
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/src/apiClient.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/src/apiKey.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/src/list.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/include/apiClient.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/include/keyValuePair.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/include/list.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/external/cJSON.licence
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/external/cJSON.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/external/cJSON.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/object.c
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/model/object.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator/samples/client/petstore/c/.openapi-generator/VERSION

@ityuhui
Copy link
Contributor

ityuhui commented Mar 23, 2020

Maybe your commit is not needed by the sample petstore.
I will review your code today or tomorrow.

@ityuhui
Copy link
Contributor

ityuhui commented Mar 23, 2020

This PR unifies the enum name to {{projectName}}{{classVarName}}{{enumName}}_e after the PR #5477

It looks good to me.

Please wait core team to merge.

@michelealbano
Copy link
Contributor

As I discussed in my PR, my code for enums did not cover model enums. This PR appears good to me.

@wing328
Copy link
Member

wing328 commented Aug 17, 2020

�[0K$ mvn --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
[�[1;31mERROR�[m] Failed to execute goal �[32morg.openapitools:openapi-generator-maven-plugin:4.2.2-SNAPSHOT:generate�[m �[1m(spring-server)�[m on project �[36msample-project�[m: �[1;31mExecution spring-server of goal org.openapitools:openapi-generator-maven-plugin:4.2.2-SNAPSHOT:generate failed: Plugin org.openapitools:openapi-generator-maven-plugin:4.2.2-SNAPSHOT or one of its dependencies could not be resolved: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:jar:2.9.10 from/to google-maven-central (https://maven-central.storage-download.googleapis.com/maven2/): GET request of: com/fasterxml/jackson/core/jackson-databind/2.9.10/jackson-databind-2.9.10.jar from google-maven-central failed�[m: Connection reset -> �[1m[Help 1]�[m

CI failure (fixed in the master) not related to this PR.

@wing328 wing328 merged commit e26a422 into OpenAPITools:master Aug 17, 2020
@wing328 wing328 added this to the 5.0.0 milestone Aug 17, 2020
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.

4 participants