We would like to use the OpenAPI support.
However, i seem to be doing something wrong or overlooking something.
I have added these lines to the server.properties:
The basic call to /restapi/openapi.yaml works but seems to output an example not present in the project:
https://pastebin.com/raw/XrULt8kj
When we call /restapi/v11.yaml we get an error:
The following is logged on the server:
Is it because i have specified the openapi.servers.servletUrl setting incorrectly or not at all?
The call to /restapi/v11 works without problems, so the DS can be loaded.
This is what the example DataSource looks like:
However, i seem to be doing something wrong or overlooking something.
I have added these lines to the server.properties:
Code:
openapi.info.version: 1.0.0 openapi.info.title: sample REST API openapi.ds.whitelisted: v11
https://pastebin.com/raw/XrULt8kj
When we call /restapi/v11.yaml we get an error:
Code:
java.lang.RuntimeException: java.util.NoSuchElementException at com.isomorphic.servlet.RESTHandler.processDocumentationRequest(RESTHandler.java:759) at com.isomorphic.servlet.RESTHandler.doGet(RESTHandler.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:178) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:750) Caused by: java.util.NoSuchElementException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:721) at java.util.LinkedHashMap$LinkedValueIterator.next(LinkedHashMap.java:747) at com.isomorphic.servlet.RESTHandler.processDocumentationRequest(RESTHandler.java:723) ... 25 more
Code:
=== 2022-11-30 15:53:32,671 [c-21] ERROR RESTHandler - DataSource 'v11' could not be loaded. java.lang.NullPointerException at java.net.URLEncoder.encode(URLEncoder.java:204) at com.isomorphic.openapi.SpecificationContextBuilder.buildOperationSpecs(SpecificationContextBuilder.java:352) at com.isomorphic.openapi.SpecificationContextBuilder.build(SpecificationContextBuilder.java:99) at com.isomorphic.servlet.RESTHandler.processDocumentationRequest(RESTHandler.java:673) at com.isomorphic.servlet.RESTHandler.doGet(RESTHandler.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:178) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:607) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:750) === 2022-11-30 15:53:32,672 [c-21] ERROR RESTHandler - BaseServlet Global Exception java.lang.RuntimeException: java.util.NoSuchElementException at com.isomorphic.servlet.RESTHandler.processDocumentationRequest(RESTHandler.java:759) at com.isomorphic.servlet.RESTHandler.doGet(RESTHandler.java:494) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:178) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:607) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:683) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:750) Caused by: java.util.NoSuchElementException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:721) at java.util.LinkedHashMap$LinkedValueIterator.next(LinkedHashMap.java:747) at com.isomorphic.servlet.RESTHandler.processDocumentationRequest(RESTHandler.java:723) ... 25 more
The call to /restapi/v11 works without problems, so the DS can be loaded.
This is what the example DataSource looks like:
Code:
<DataSource xmlns:fmt="WEB-INF/" tableName="v11" ID="v11" serverType="sql"> <fmt:bundle basename="de.escrea.shared.util.EscreaConstants" encoding="utf-8" /> <fields> <field primaryKey="true" hidden="true" name="id" type="sequence"></field> <field name="status" type="text"> <title><fmt:message key="status"/></title> </field> <field name="fileName" type="text"> <title><fmt:message key="fileName"/></title> </field> <field name="participantNumber" type="text"> <title><fmt:message key="participantNumber"/></title> </field> <field name="amount" type="float"> <title><fmt:message key="sum"/></title> </field> <field name="numberOfTransactions" type="integer"> <title><fmt:message key="paymentsCount"/></title> </field> <field name="partial" type="integer" customSelectExpression="COALESCE((SELECT COUNT(*) FROM v11Transaction LEFT JOIN postingItem ON v11Transaction.postingItemId = postingItem.id LEFT JOIN payment ON payment.postingItemId = postingItem.id WHERE v11Transaction.v11Id = v11.id AND payment.cancelDate IS NULL), 0)" customSQL="true"> <title><fmt:message key="incompleteNumber"/></title> </field> <field name="startDate" type="date"> <title><fmt:message key="dateStart"/></title> </field> <field name="endDate" type="date"> <title><fmt:message key="dateEnd"/></title> </field> <field name="creationDate" type="date"> <title><fmt:message key="dateV11"/></title> </field> </fields> <operationBindings> <operationBinding operationType="fetch" operationId="assignV11"> <serverObject className="de.escrea.server.BillingDMI" methodName="importV11" /> </operationBinding> <operationBinding operationType="fetch"> <customValueFields>partial</customValueFields> <customCriteriaFields>partial</customCriteriaFields> <orderClause> #if($dsRequest.sortBy) $defaultOrderClause, creationDate DESC #else creationDate DESC #end </orderClause> </operationBinding> </operationBindings> </DataSource>
Comment