Problem with importing openapi

Originally posted by darekdg6pl on December 09, 2022

Team, I’m facing problems with importing OpenAPI specification.

SoapUI 5.7.0, Windows, schema https://instana.github.io/openapi/openapi.json, error I got:

  • Fri Dec 09 09:43:15 CET 2022:ERROR:java.lang.NullPointerException: Cannot invoke “com.smartbear.swagger.SwaggerImporter.importSwagger(String)” because “this.val$importer” is null
  • java.lang.NullPointerException: Cannot invoke “com.smartbear.swagger.SwaggerImporter.importSwagger(String)” because “this.val$importer” is null
  • at com.smartbear.swagger.SwaggerUtils$1.construct(SwaggerUtils.java:143)
  • at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
  • at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:131)
  • at java.base/java.lang.Thread.run(Thread.java:831)

Any suggestions what might be wrong? The specification seems to be just fine. Thanks for any advice!

Originally posted by mcarmain on June 09, 2023

I have same issue importing swagger.json that is version 3

Originally posted by mju on November 17, 2023

The code tests for the swagger version and the logic is basically:

if (yaml or yml) import with swagger2

else //i.e. .json

if (version = swagger 2.0) import with swagger2

else return null ==> exception

The workaround for openapi files in .json format seems to be to replace this (e.g. for version 3.0.1)

{"openapi":"3.0.1"

with

{"swagger":"2.0"

and then to import the file.