-
Type:
Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: Master
-
Fix Version/s: 7.0.X, 7.1.10 DXP FP19, 7.1.10.5 SP5, 7.1.X, 7.2.10 DXP FP7, 7.2.X, 7.3.3 CE GA4, 7.3.4 CE GA5, 7.3.10 DXP GA1, Master
-
Component/s: REST Builder
-
Branch Version/s:7.2.x, 7.1.x, 7.0.x
-
Backported to Branch:Committed
-
Fix Priority:3
-
Git Pull Request:
Executing REST Builder with an OpenAPI yaml file which includes some tags that are not including as schema in the Components Object causes an error in the API generation
Steps to reproduce it:
- Create a new module with the attached YAML files (modifying configuration if needed).
- Execute
gw buildRest
Result: Exception is thrownmay 28, 2020 8:57:34 AM freemarker.log._JULLoggerFactory$JULLogger error GRAVE: Error executing FreeMarker template FreeMarker template error: The following has evaluated to null or missing: ==> freeMarkerTool.getJavaDataType(configYAML, openAPIYAML, schemaName) [in template "com/liferay/portal/tools/rest/builder/dependencies/base_resource_test_case.ftl" at line 1793, column 71]---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? -------- FTL stack trace ("~" means nesting-related): - Failed at: ${freeMarkerTool.getJavaDataType(conf... [in template "com/liferay/portal/tools/rest/builder/dependencies/base_resource_test_case.ftl" at line 1793, column 69] ----Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) at freemarker.core.EvalUtil.coerceModelToTextualCommon(EvalUtil.java:467) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:389) at freemarker.core.EvalUtil.coerceModelToStringOrMarkup(EvalUtil.java:358) at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100) at freemarker.core.DollarVariable.accept(DollarVariable.java:63) at freemarker.core.Environment.visit(Environment.java:330) at freemarker.core.Environment.visit(Environment.java:336) at freemarker.core.Environment.process(Environment.java:309) at freemarker.template.Template.process(Template.java:384) at com.liferay.portal.tools.rest.builder.internal.freemarker.FreeMarker.processTemplate(FreeMarker.java:60) at com.liferay.portal.tools.rest.builder.internal.freemarker.util.FreeMarkerUtil.processTemplate(FreeMarkerUtil.java:32) at com.liferay.portal.tools.rest.builder.RESTBuilder._createBaseResourceTestCaseFile(RESTBuilder.java:490) at com.liferay.portal.tools.rest.builder.RESTBuilder.build(RESTBuilder.java:300) at com.liferay.portal.tools.rest.builder.RESTBuilder.main(RESTBuilder.java:115)Exception in thread "main" java.lang.RuntimeException: Error generating REST API The following has evaluated to null or missing: ==> freeMarkerTool.getJavaDataType(configYAML, openAPIYAML, schemaName) [in template "com/liferay/portal/tools/rest/builder/dependencies/base_resource_test_case.ftl" at line 1793, column 71]---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? -------- FTL stack trace ("~" means nesting-related): - Failed at: ${freeMarkerTool.getJavaDataType(conf... [in template "com/liferay/portal/tools/rest/builder/dependencies/base_resource_test_case.ftl" at line 1793, column 69] ---- at com.liferay.portal.tools.rest.builder.RESTBuilder.main(RESTBuilder.java:125) FAILURE: Build failed with an exception.
Expected Result: Ignore the tag or throw a controlled error that allows to identify the root cause