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

Use bin/cpp-qt5-petstore.json #4547

Merged

Conversation

MartinDelille
Copy link
Contributor

This PR use the new --config option in the bin/cpp-qt5-petstore.sh script.

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.

@ravinikam @stkrwork @etherealjoy @muttleyxd @jimschubert

@wing328 wing328 added this to the 4.2.2 milestone Nov 20, 2019
@wing328 wing328 merged commit 5238597 into OpenAPITools:master Nov 20, 2019
Copy link
Contributor Author

@MartinDelille MartinDelille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this PR broke the bin/cpp-qt5-petstore.sh script.

I ran it but since it fails silently, I didn't notice that the cpp-qt5-petstore.json is not found:

$ bin/cpp-qt5-petstore.sh
# START SCRIPT: bin/cpp-qt5-petstore.sh
[main] ERROR o.o.c.config.CodegenConfigurator - Unable to deserialize config file: cpp-qt5-petstore.json
java.io.FileNotFoundException: cpp-qt5-petstore.json (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:155)
	at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:766)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2903)
	at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:97)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:261)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
[main] ERROR o.o.c.config.CodegenConfigurator - Unable to deserialize config file: cpp-qt5-petstore.json
java.io.FileNotFoundException: cpp-qt5-petstore.json (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:213)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:155)
	at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:766)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2903)
	at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:97)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:261)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
[main] INFO  o.o.codegen.DefaultGenerator - OpenAPI Generator: cpp-qt5-client (client)
[main] INFO  o.o.codegen.DefaultGenerator - Generator 'cpp-qt5-client' is considered stable.
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] INFO  o.o.c.languages.AbstractCppCodegen - Environment variable CPP_POST_PROCESS_FILE not defined so the C++ code may not be properly formatted. To define it, try 'export CPP_POST_PROCESS_FILE="/usr/local/bin/clang-format -i"' (Linux/Mac)
[main] INFO  o.o.c.languages.AbstractCppCodegen - NOTE: To enable file post-processing, 'enablePostProcessFile' must be set to `true` (--enable-post-process-file for CLI).
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIApiResponse.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIApiResponse.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAICategory.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAICategory.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIOrder.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIOrder.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIPet.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIPet.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAITag.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAITag.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIUser.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIUser.cpp
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[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 content, returning only the first one
[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 content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] WARN  o.o.codegen.utils.ModelUtils - Multiple schemas found in content, returning only the first one
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIPetApi.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIPetApi.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIStoreApi.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIStoreApi.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIUserApi.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIUserApi.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHelpers.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHelpers.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHttpRequest.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHttpRequest.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHttpFileElement.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIHttpFileElement.cpp
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIObject.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/OAIEnum.h
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/CMakeLists.txt
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./client/client.pri
[main] INFO  o.o.codegen.AbstractGenerator - writing file ./.openapi-generator/VERSION

@@ -30,8 +30,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
args="generate -t modules/openapi-generator/src/main/resources/cpp-qt5-client \
-i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimschubert This line could be removed but the cli fails if -i is not set

@wing328
Copy link
Member

wing328 commented Nov 20, 2019

No worry. Let me try to fix it.

@wing328
Copy link
Member

wing328 commented Nov 20, 2019

Fixed via 96bbab9

We'll find a better way to catch similar issues moving forward.

@MartinDelille
Copy link
Contributor Author

I would be cool to have a job that launch the generating scripts, check if they fails and check if there is some diff with git diff --exit-code.

Is there an issue about it or shall I create it?

@wing328
Copy link
Member

wing328 commented Nov 20, 2019

We've that in the CI already but the problem with missing config file is that the codegen process still proceeds with default config and completes successfully (exit status code: 0) so it's hard to catch.

We'll instead throw a Runtime exception similar to what we've done for other file input.

@jimschubert
Copy link
Member

@wing328 we should explicitly reference the root directory. Many of our scripts rely on the original execution path.

@wing328
Copy link
Member

wing328 commented Nov 20, 2019

Many of our scripts rely on the original execution path.

That's what it's from day 1 I started contributing to this project. Agreed with your suggestion but it will be a lot of work that I would rather suggest spend on other tasks with higher priority instead.

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.

3 participants