简体   繁体   中英

while using openapi Braid for generating api for my corda project its showing some error in the last steep

Downloads\bootcamp-openapi-master\bootcamp-openapi-master\build\nodes>openapi-generator generate -i http://localhost:10200/swagger.json -g javascript -o ./code-gen --
api-package io.generated.api --model-package io.generated.model
[main] ERROR io.swagger.v3.parser.util.RemoteUrl - unable to read
java.net.SocketException: Unexpected end of file from server
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)

I am trying to work on the corda openapi generation project but its showing me above error in the last step. The project I am trying to work is
https://blog.b9lab.com/cordacon-2019-highlights-braid-server-and-openapi-generator-for-corda-flows-api-s-d24179ccb27c and similar https://github.com/corda/openapi-sample

But the problem is that I have done same as show in the link but my last step that is generating api is not executing and throwing the above mentioned errors. And one more thing is that my one step is showing different output compared to the one shown in the Git.

MY OUTPUT

10:03:39.328 [main] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - Starting Braid on port: 10200
10:03:39.718 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupRouter starting...
10:03:39.781 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.DocsHandlerFactory - activating OpenAPI V3
10:03:39.874 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - swagger json bound to https://localhost:10200/swagger.json
10:03:39.890 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - Swagger UI bound to https://localhost:10200/
10:03:42.999 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - registering: /cordapps/bootcamp-openapi-master/flows/bootcamp.GetAllTokensFlow
10:03:43.062 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - registering: /cordapps/bootcamp-openapi-master/flows/bootcamp.TokenIssueFlowInitiator
10:03:43.108 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - REST end point bound to https://localhost:10200/api/rest
10:03:43.108 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupRouter complete -- 3406 msec
10:03:43.889 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupWebserver complete -- 781 msec
10:03:43.889 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - Braid server started on
10:03:43.905 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - Braid service mounted on https://localhost:10200/api/
10:03:43.905 [vert.x-eventloop-thread-1] INFO  io.bluebank.braid.corda.BraidServer - Braid server started successfully on 10200

Their OUTPUT


10:03:39.328 [main] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - Starting Braid on port: 10200
10:03:39.718 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupRouter starting...
10:03:39.781 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.DocsHandlerFactory - activating OpenAPI V2
10:03:39.874 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - swagger json bound to http://localhost:10200/swagger.json
10:03:39.890 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - Swagger UI bound to http://localhost:10200/
10:03:42.999 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - registering: /cordapps/bootcamp-openapi-master/flows/bootcamp.GetAllTokensFlow
10:03:43.062 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.server.BraidCordaStandaloneServer - registering: /cordapps/bootcamp-openapi-master/flows/bootcamp.TokenIssueFlowInitiator
10:03:43.108 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.rest.RestMounter - REST end point bound to http://localhost:10200/api/rest
10:03:43.108 [braid-startup-threadpool-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupRouter complete -- 3406 msec
10:03:43.889 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - BraidVerticle.setupWebserver complete -- 781 msec
10:03:43.889 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - Braid server started on
10:03:43.905 [vert.x-eventloop-thread-0] INFO  io.bluebank.braid.corda.BraidVerticle - Braid service mounted on https://localhost:10200/api/
10:03:43.905 [vert.x-eventloop-thread-1] INFO  io.bluebank.braid.corda.BraidServer - Braid server started successfully on 10200

The difference is that their don't contains https but I don't think this could raise any error.

In your Braid server output it says activating OpenAPI V2 meaning your server is generating the API's with OpenAPI Specification version 2 , while your openapi-generator is throwing error ERROR io.swagger.v3.parser.util.RemoteUrl meaning it's looking for v3 (not v2 ) that's why it's unable to parse the file.
In my Medium article (and R3 tutorial) we both use v3 .
From my article (notice the 3 after 10200 :

localhost:10004 user1 test 10200 3 “/home/your-user/path-to-project/bootcamp-openapi/build/nodes/PartyA/cordapps”

From R3's article (notice how we both use openapi version 3 ):

Now, find the down triangle to open up the run configuration. At the Program arguments, paste in: 
localhost:10004 user1 test 10200 3 
"/YOUR-PATH-TO-THIS-FOLDER/bootcamp-cordapp/build/nodes/PartyA/cordapps"

RPC connection address: localhost:10004
node login username: user1
node login password: test
Your desired expose port: 10200
openapi version: 3
Cordapp folder to pick up the jar: "YOUR-PATH-TO-THIS-FOLDER/bootcamp-cordapp/build/nodes/PartyA/cordapps"

So I'm not sure why you decided to use version 2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM