Feature/mustache lambda tests (#3447)

* Mustache lambda tests

* If lambda key is already taken in additionalProperties, throw an exception.

* Test whether common lambdas are registered in additionalProperties.
This commit is contained in:
Michal Foksa
2019-08-11 04:15:40 +02:00
committed by Jim Schubert
parent ac85c8f901
commit 42d6420400
9 changed files with 315 additions and 10 deletions

View File

@@ -240,13 +240,10 @@ public class DefaultCodegen implements CodegenConfig {
}
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);
LOGGER.error("A property called 'lambda' already exists in additionalProperties");
throw new RuntimeException("A property called 'lambda' already exists in additionalProperties");
}
additionalProperties.put("lambda", lambdas);
}
// override with any special post-processing for all models