Feature/mustache lambda tests#3447
Feature/mustache lambda tests#3447jimschubert merged 3 commits intoOpenAPITools:masterfrom MichalFoksa:feature/mustache-lambda-tests
Conversation
There was a problem hiding this comment.
Has the detailed message moved elsewhere? If not, we should keep the link to templating docs.
There was a problem hiding this comment.
Hi @jimschubert
I am sorry, I do not understand the question.
Condition if (additionalProperties.containsKey("lambda")) should never evaluate to true and if then only because something has changed in DefautlCodegen and that will be caught at first instantiation of DefautlCodegen - in unit tests.
I think the construct bellow made sense when it was in a generator derived from DefaultCodegen, but not now.
if (additionalProperties.containsKey("lambda")) {
LOGGER.warn("A property named 'lambda' already exists. Mustache lambdas renamed from 'lambda' to '_lambda'. " +
"You'll likely need to use a custom template, " +
"see https://github.com/OpenAPITools/openapi-generator/blob/master/docs/templating.md. ");
additionalProperties.put("_lambda", lambdas);
} else {
additionalProperties.put("lambda", lambdas);
}
Makes sense?
There was a problem hiding this comment.
I see, thanks for the clarification. I incorrectly remembered your earlier change being in DefaultGenerator, and missed that it's actually called in this class constructor.
|
Re-based PR to current master. |
|
Sorry for the delay. Thanks for writing these tests and for updating the branch! |
|
@jimschubert No problem, You have been working on 4.1.0. BTW: Congrats on the release. Now I can replace custom build generator with the 4.1.0 release in all of my repos. I really appreciate it, Michal |
|
@MichalFoksa thanks for the PR, which has been included in the v4.1.1 release: https://twitter.com/oas_generator/status/1165944867391860737 |
|
😄 you are welcome. Congrats to release. |
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master,4.1.x,5.0.x. Default:master.Description of the PR
Follow up PR to #3368.
_lambdakey whenlambdais already take in additionalProperties. It is possible only iflambdakey was taken byDefaultCodegenitself.