Open HugoSentelien opened 5 years ago
I am commenting instead of editing because I found how to prevent the crash, but it can lead to even more errors later on for other OpenAPI file.
So, I tried with the different images release (https://hub.docker.com/r/openapitools/openapi-generator-online/tags) and the bug seems to have been introduced as soon as the v4.0.0 (more than 6 months ago).
The "patch" I did is to delete the file only if he is not null:
It is a modification of this line: https://github.com/OpenAPITools/openapi-generator/blob/d7b390f328a597438edd6a72a9f1ff495ca7080a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java#L166
Once modifier, the output for both the openapi-generator-online and cli version are the SAME (except the versioning in the file and some placeholders, but I verified every other changes with a git diff) for the code generation for this file: https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml
I hope it was understandable and it could help 😄
This issue still seems to be present. I have tried csharp, java, and python; it works fine. It's just with php.
Any update on the issue?
Bug Report Checklist
Description
I can't generate any PHP library with the openapi-generator-online, while I can with the CLI version. The bug is the same for PHP client or server's framework (php-laravel, php-lumen, php-silex, php-slim, php-symfony, php-ze-ph). The bug is present on both the online test server and my Docker's instance: http://api.openapi-generator.tech/index.html https://hub.docker.com/r/openapitools/openapi-generator
The displayed message is: "{ "timestamp": "2019-10-29T09:19:38.809Z", "status": 400, "error": "Bad Request", "message": "Unable to build target: null", "path": "/api/gen/clients/php" }"
The expected response should have been with a status 200 (we can see it if we try the "ada" language).
openapi-generator version
4.1.3 openapi-generator-online
OpenAPI declaration file content or url
This bug doesn't seem to be yaml oriented, but it can be easily reproduced with this one: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml
Command line used for generation
On the request "POST /api/gen/clients/{language}", use {language}="php" and:
Steps to reproduce
Related issues/PRs
N/A
Suggest a fix
The only place in the code where this message can be returned seems to come from this file: https://github.com/OpenAPITools/openapi-generator/blob/d7b390f328a597438edd6a72a9f1ff495ca7080a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java#L166 files" is null.
We can see it on this screenshot of a debug execution:
with an error between the line 153 and 159 (included).The error comes from the line 166, because an element (the 28th) of the "List