Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-131695

Generation error with a component of type array

Details

    • Bug
    • Status: Verified
    • Resolution: Unresolved
    • Master
    • None
    • REST Builder
    • None
    • 3

    Description

      If you add a component of type array to the OpenAPI components section, there is a generation error in REST Builder caused by a NullPointerException:

      [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.liferay:com.liferay.portal.tools.rest.builder:1.0.22:build (default-cli) on project ibkdocRest-impl: null: MojoExecutionException: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay:com.liferay.portal.tools.rest.builder:1.0.22:build (default-cli) on project ibkdocRest-impl: null at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289) at org.apache.maven.cli.MavenCli.main(MavenCli.java:193) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) Caused by: org.apache.maven.plugin.MojoExecutionException at com.liferay.portal.tools.rest.builder.maven.BuildRESTMojo.execute(BuildRESTMojo.java:41) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210) ... 20 more Caused by: java.lang.NullPointerException at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.parser.ResourceOpenAPIParser._getReturnType(ResourceOpenAPIParser.java:636) at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.parser.ResourceOpenAPIParser.lambda$getJavaMethodSignatures$1(ResourceOpenAPIParser.java:78) at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.parser.ResourceOpenAPIParser._visitOperations(ResourceOpenAPIParser.java:708) at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.parser.ResourceOpenAPIParser.getJavaMethodSignatures(ResourceOpenAPIParser.java:75) at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool.getResourceJavaMethodSignatures(FreeMarkerTool.java:226) at com.liferay.portal.tools.rest.builder.RESTBuilder._fixOpenAPIOperationIds(RESTBuilder.java:1038) at com.liferay.portal.tools.rest.builder.RESTBuilder._checkOpenAPIYAMLFile(RESTBuilder.java:288) at com.liferay.portal.tools.rest.builder.RESTBuilder.build(RESTBuilder.java:153) at com.liferay.portal.tools.rest.builder.maven.BuildRESTMojo.execute(BuildRESTMojo.java:38) ... 22 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      

       

      More info can be found in the community slack thread: https://liferay-community.slack.com/archives/CUCUYB1EE/p1620113795108900

       
      For example, this could be a schema definition that is currently failing:

      MyStatusArray:
          description: my status array
          items:
              $ref: "#/components/schemas/Status"
              type: array
      

       

       

      Attachments

        Activity

          People

            team-headless Product Team Headless
            javier.dearcos Javier de Arcos Velilla
            Bruno Fernández Bruno Fernández
            Javier de Arcos Velilla Javier de Arcos Velilla
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              28 weeks, 1 day ago

              Packages

                Version Package