Code Monkey home page Code Monkey logo

dev24restbuilder's People

Contributors

martin-dominguez avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

canopidev

dev24restbuilder's Issues

Liferay Portal 7.3.0 ga1 REST Builder Issue With Dependency

Hi Martin ,

i have tried to implement this in 7.3.0 ga1 but having a dependency issue. please check the below code.

Restbuilder-impl build.gradle File.

buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins.rest.builder", version: "1.0.114"
}

repositories {
    maven {
        url "https://repository-cdn.liferay.com/nexus/content/groups/public"
    }
}

}

apply plugin: "com.liferay.portal.tools.rest.builder"

dependencies {
compileOnly group: "org.osgi", name: "org.osgi.core"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
compileOnly group: "com.liferay.portal", name: "release.portal.api", version: "7.3.0-ga1"
compileOnly project(":modules:RestBuilder-api")
}

I am able to Restbuild successfully . after adding "compileOnly group: "com.liferay.portal", name: "release.portal.api", version: "7.3.0-ga1" this, still i have many things as not resolve . check below sceenshot.
Capture

Openapi return type array issue

Hi Martin,
Below is my yaml file. it looks good and no error with swager editor. But when i build using RESTBuild . it throws error of StringIndexOutofbound. Can you please look into it???
When i add array as response in path it throws this error..

info:
description: "An example about how to create an API usign the Rest Builder Tool"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
title: "LidereSalud RestBuilder API"
version: v1.0
openapi: 3.0.1
components:
schemas:
IsSpecialist:
description: "This is an example of an Object"
properties:
name:
description: "The Object Id"
type: string
description:
description: "The Object Name"
type: string
imageURL:
description: "URL"
type: string
imageDlId:
type: integer
imageData:
type: string
imageName:
type: string
groupId:
type: integer
companyId :
type: integer
localeCountry:
type: string
localeCode:
type: string

paths:
"/isSpecialist":
get:
description: "Gets a list of Objects"
operationId: getIsSpecialistObjectsPage
responses:
200:
description: ""
content:
application/json:
schema:
items:
$ref: "#/components/schemas/IsSpecialist"
type: array
application/xml:
schema:
items:
$ref: "#/components/schemas/IsSpecialist"
type: array
tags: ["IsSpecialist"]

post:
  description: "Creates a new Object"
  operationId: postIsSpecialistObject
  requestBody:
    content:
      application/json:
        schema:
           $ref: "#/components/schemas/IsSpecialist"
      application/xml:
        schema:
           $ref: "#/components/schemas/IsSpecialist"
  responses:
    200:
      description: ""
      content:
        application/json:
          schema:
             $ref: "#/components/schemas/IsSpecialist"
        application/xml:
          schema:
             $ref: "#/components/schemas/IsSpecialist"
  tags: ["IsSpecialist"]

"/isSpecialist/byLocalization":
get:
operationId: getIsSpecialistByLocale
description: "Get an Object by id"
parameters:
- in: query
name: locale_Country
required: true
schema:
type: string
- in: query
name: locale_Code
required: true
schema:
type: string
responses:
200:
description: ""
content:
application/json:
schema:
items:
$ref: "#/components/schemas/IsSpecialist"
type: array
application/xml:
schema:
items:
$ref: "#/components/schemas/IsSpecialist"
type: array

  tags: ["IsSpecialist"]

"/isSpecialist/byGroupCompany":
get:
operationId: getIsSpecialist
description: "Get an Object by id"
parameters:
- in: query
name: group_Id
required: true
schema:
type: integer
- in: query
name: company_Id
required: true
schema:
type: integer
responses:
200:
description: ""
content:
application/json:
schema:
items:
$ref: "#/components/schemas/IsSpecialist"
type: array

        application/xml:
          schema:
            items:
              $ref: "#/components/schemas/IsSpecialist"
            type: array
           
            
  tags: ["IsSpecialist"]

Error ::

Writing D:\Liferay\Letest\Restbuilder-Graphql\Test\modules\RestBuilder-impl\rest-openapi.yaml
Oct 05, 2020 1:49:03 AM freemarker.log._JULLoggerFactory$JULLogger error
SEVERE: Error executing FreeMarker template
FreeMarker template error:
Java method "com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool.getGraphQLMethodJavadoc(com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.JavaMethodSignature, List, com.liferay.portal.tools.rest.builder.internal.yaml.openapi.OpenAPIYAML)" threw an exception when invoked on com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool object "com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool@4ff4357f"; see cause exception in the Java stack trace.


FTL stack trace ("~" means nesting-related):
- Failed at: ${freeMarkerTool.getGraphQLMethodJava... [in template "com/liferay/portal/tools/rest/builder/dependencies/graphql_query.ftl" at line 70, column 20]

Java stack trace (for programmers):

freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...]
at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:289)
at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:252)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:77)
at freemarker.core.MethodCall._eval(MethodCall.java:65)
at freemarker.core.Expression.eval(Expression.java:83)
at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100)
at freemarker.core.DollarVariable.accept(DollarVariable.java:63)
at freemarker.core.Environment.visit(Environment.java:366)
at freemarker.core.IteratorBlock$IterationContext.executedNestedContentForCollOrSeqListing(IteratorBlock.java:317)
at freemarker.core.IteratorBlock$IterationContext.executeNestedContent(IteratorBlock.java:271)
at freemarker.core.IteratorBlock$IterationContext.accept(IteratorBlock.java:242)
at freemarker.core.Environment.visitIteratorBlock(Environment.java:642)
at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:107)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:93)
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._createGraphQLQueryFile(RESTBuilder.java:936)
at com.liferay.portal.tools.rest.builder.RESTBuilder.build(RESTBuilder.java:235)
at com.liferay.portal.tools.rest.builder.RESTBuilder.main(RESTBuilder.java:116)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at com.liferay.portal.vulcan.graphql.util.GraphQLNamingUtil.getGraphQLPropertyName(GraphQLNamingUtil.java:49)
at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool.getGraphQLPropertyName(FreeMarkerTool.java:365)
at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool._getGraphQLBody(FreeMarkerTool.java:856)
at com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool.getGraphQLMethodJavadoc(FreeMarkerTool.java:320)
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 freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1505)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:72)
... 20 more

Exception in thread "main" java.lang.RuntimeException: Error generating REST API
Java method "com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool.getGraphQLMethodJavadoc(com.liferay.portal.tools.rest.builder.internal.freemarker.tool.java.JavaMethodSignature, List, com.liferay.portal.tools.rest.builder.internal.yaml.openapi.OpenAPIYAML)" threw an exception when invoked on com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool object "com.liferay.portal.tools.rest.builder.internal.freemarker.tool.FreeMarkerTool@4ff4357f"; see cause exception in the Java stack trace.


FTL stack trace ("~" means nesting-related):
- Failed at: ${freeMarkerTool.getGraphQLMethodJava... [in template "com/liferay/portal/tools/rest/builder/dependencies/graphql_query.ftl" at line 70, column 20]

at com.liferay.portal.tools.rest.builder.RESTBuilder.main(RESTBuilder.java:126)

Task :modules:RestBuilder-impl:buildREST FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':modules:RestBuilder-impl:buildREST'.

Process 'command 'C:\Program Files\Java\jdk1.8.0_241\bin\java.exe'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 24s
1 actionable task: 1 executed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.