openapi oneOf array or object -> nullpointer?

104 views
Skip to first unread message

Kurt Sys

unread,
May 18, 2019, 5:17:39 AM5/18/19
to vert.x
Hey all,

In my openapi-model:
      properties:
       
...
        occurrence
:
          oneOf
:
           
- type: array
              items
:
                type: string
           
- $ref: "occurrence.yaml#/Occurrence"

works fine. However, this fails:
 
      properties:
       
...
        occurrence
:
          oneOf
:
           
- type: array
              items
:
                $ref: "occurrence.yaml#/Occurrence"
            - $ref: "occurrence.yaml#/Occurrence"

giving this error (exception):

INFO: started OpenAPI: true
mei
18, 2019 11:10:57 A.M. io.vertx.core.impl.ContextImpl
SEVERE
: Unhandled exception
java
.lang.NullPointerException
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.walkAndSolve(OpenApi3Utils.java:218)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.replaceRef(OpenApi3Utils.java:273)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.walkAndSolve(OpenApi3Utils.java:219)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.walkAndSolve(OpenApi3Utils.java:240)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.walkAndSolve(OpenApi3Utils.java:231)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.walkAndSolve(OpenApi3Utils.java:237)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenApi3Utils.generateSanitizedJsonSchemaNode(OpenApi3Utils.java:213)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenAPI3RequestValidationHandlerImpl.parseRequestBody(OpenAPI3RequestValidationHandlerImpl.java:494)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenAPI3RequestValidationHandlerImpl.parseOperationSpec(OpenAPI3RequestValidationHandlerImpl.java:104)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenAPI3RequestValidationHandlerImpl.<init>(OpenAPI3RequestValidationHandlerImpl.java:87)
    at io
.vertx.ext.web.api.contract.openapi3.impl.OpenAPI3RouterFactoryImpl.getRouter(OpenAPI3RouterFactoryImpl.java:302)
    at
....RouterConfig.invoke(RouterConfig.java:36)
    at
....WebApi.lambda$start$0(WebApi.java:22)

I fail to see the problem...

Francesco Guardiani

unread,
May 20, 2019, 3:57:54 AM5/20/19
to vert.x
Where do you use this schema? In a request body?

Kurt Sys

unread,
May 20, 2019, 5:23:43 AM5/20/19
to vert.x
Yes... in a request body.

Op maandag 20 mei 2019 09:57:54 UTC+2 schreef Francesco Guardiani:

Francesco Guardiani

unread,
May 21, 2019, 5:30:37 AM5/21/19
to vert.x
This is unexpected, can you open an issue on vertx-web with a simple reproducer? Thank you :)

Cristiano

unread,
May 21, 2019, 7:05:23 AM5/21/19
to vert.x
my suggestion is you to try it with an updated version of parser since you are using $ref. there was a lot of fixes on this matter:

        <dependency>
           
<groupId>io.swagger.parser.v3</groupId>
           
<artifactId>swagger-parser</artifactId>
           
<version>2.0.12</version>
       
</dependency>



Reply all
Reply to author
Forward
0 new messages