SmartBear / readyapi-swagger-plugin

Ready! API Plugin for importing Swagger definitions as REST Services
36 stars 27 forks source link

error on creating project out of swagger spec #3

Open micha-heigl opened 10 years ago

micha-heigl commented 10 years ago

I go to http://editor.swagger.io and load the default example file. Then I download both spec.json and spec.yaml. When I try to create a new Project in SoapUI Pro by using the downloaded spec.json as Swagger Definition the import fails with

Error java.lang.RuntimeException: Unknown Swagger Version: null

When I try to import spec.yaml instead, the import fails with

Error java.lang.NullPointerException: Cannot get property 'basePath' on null object

The swagger spec is version 2.0. I'm using SoapUI Pro 5.1.2 with soapui-swagger-plugin-0.3.1-plugin-dist installed.

olensmar commented 10 years ago

Hi!

you will need to use the latest swagger plugin (version 2.0) available from the plugin-repository from within SoapUI Pro 5.X or Ready! API to be able to import Swagger 2.0 specs - can you give that a try?

thanks!

/Ole

pvdyck commented 9 years ago

Same problem here (basepath) ... with the latest version of the plugin directly downloaded from Ready! API.

tokarthik commented 9 years ago

I am also facing the same issue with ReadyAPI1.2.1 any help much appreciated Thanks in Advance

tokarthik commented 9 years ago

@olensmar I am using the v2.0 and ready API 1.2.1 could you please help me Thanks in Advance

olensmar commented 9 years ago

thanks guys - an update of the plugin is in the making - if any one of you could share your swagger specs with me so I can make sure they work that would be grand - please send to ole.lensmar@smartbear.com if possible!

/Ole

tokarthik commented 9 years ago

@olensmar Thank You very much currently we have local instance which you can't access if you fixed please let me know i will check and let you know Thanks in Advance
karthik I will mail you as well

pvdyck commented 9 years ago

The sample specs @ http://editor.swagger.io/#/ fails to load (I tried others, same error).

Thanks !

(P.S. working for a multinational bank right now and about to include SoapUI as a main testing component)

tokarthik commented 9 years ago

thanks for your input @pvdyck

olensmar commented 9 years ago

@pvdyck I've sent you an update of the plugin - please let me know how it works so I can either fix or publish. Thanks all!

olensmar commented 9 years ago

ok - the plugin seems to work now - anyone else want to give it a try before we publish it?

Thanks in advance

/Ole

Smeedy commented 9 years ago

@olensmar YGM. Included an example I'm working on right now. Same errors when using the Petstore examples. Willing to test the plugin, let me know.

great work, cheers, Martijn

olensmar commented 9 years ago

Guys - the new version of the plugin (2.1) is live in the plugin repository - if you have any issues please let me know! Thanks for your help!

/Ole

neoecos commented 9 years ago

@olensmar I just tried, i'm not able to load a 2.0 spec. The spec is correct, i checked in http://editor.swagger.io/

selection_014

olensmar commented 9 years ago

darn!

can you share the spec?

neoecos commented 9 years ago

@olensmar this is it.

http://pastie.org/private/kzvoxwn2eh5xr4anfdth1a

Also this is the console log

================================
=
= SOAPUI_HOME = /home/sortiz/sw/SoapUI-5.1.3
=
================================
Configuring log4j from [/home/sortiz/sw/SoapUI-5.1.3/bin/soapui-log4j.xml]
15:21:10,875 INFO  [SoapUI] Adding [/home/sortiz/sw/SoapUI-5.1.3/bin/ext/javax.json-1.0-b06.jar] to extensions classpath
15:21:10,876 INFO  [SoapUI] Adding [/home/sortiz/sw/SoapUI-5.1.3/bin/ext/swagger4j-1.0-beta4.jar] to extensions classpath
15:21:11,050 INFO  [DefaultSoapUICore] initialized soapui-settings from [/home/sortiz/soapui-settings.xml]
15:21:11,595 INFO  [DefaultSoapUICore] Adding plugin from [/home/sortiz/sw/SoapUI-5.1.3/bin/plugins/soapui-swagger-plugin-0.3.1-plugin.jar]
Configuring log4j from [/home/sortiz/sw/SoapUI-5.1.3/bin/soapui-log4j.xml]
15:21:12,123 INFO  [SoapUI] Adding [/home/sortiz/sw/SoapUI-5.1.3/bin/ext/javax.json-1.0-b06.jar] to extensions classpath
15:21:12,123 INFO  [SoapUI] Adding [/home/sortiz/sw/SoapUI-5.1.3/bin/ext/swagger4j-1.0-beta4.jar] to extensions classpath
15:21:12,137 INFO  [DefaultSoapUICore] initialized soapui-settings from [/home/sortiz/soapui-settings.xml]
15:21:12,144 INFO  [DefaultSoapUICore] Adding plugin from [/home/sortiz/sw/SoapUI-5.1.3/bin/plugins/soapui-swagger-plugin-0.3.1-plugin.jar]
15:21:12,317 WARN  [AnalyticsManager] Error generating Analytics session ID - returning empty String
java.lang.NullPointerException
    at com.eviware.soapui.analytics.AnalyticsManager.makeUserId(AnalyticsManager.java:140)
    at com.eviware.soapui.analytics.AnalyticsManager.<init>(AnalyticsManager.java:30)
    at com.eviware.soapui.analytics.AnalyticsManager.getInstance(AnalyticsManager.java:35)
    at com.eviware.soapui.analytics.Analytics.getAnalyticsManager(Analytics.java:16)
    at com.eviware.soapui.analytics.AnalyticsHelper.InitializeAnalytics(AnalyticsHelper.java:39)
    at com.eviware.soapui.SoapUI.startSoapUI(SoapUI.java:803)
    at com.eviware.soapui.SoapUI$SoapUIRunner.run(SoapUI.java:671)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:738)
    at java.awt.EventQueue.access$300(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:699)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:708)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
15:21:12,331 INFO  [WorkspaceImpl] Loading workspace from [/home/sortiz/default-soapui-workspace.xml]
15:21:12,439 INFO  [SoapUI] Used java version: 1.7.0_76
15:21:52,540 ERROR [SoapUI] An error occurred [Unknown Swagger Version: null], see error log for details
15:24:08,836 INFO  [DefaultSoapUICore] Settings saved to [/home/sortiz/soapui-settings.xml]
15:24:09,817 INFO  [WorkspaceImpl] Saved workspace to [/home/sortiz/default-soapui-workspace.xml]
exiting..
neoecos commented 9 years ago

@olensmar any development on this issue, how can I help?

olensmar commented 9 years ago

not yet - i'll fix it over the weekend - sorry to keep you waiting!

neoecos commented 9 years ago

Thank you!

On Fri, Apr 17, 2015 at 12:09 PM, Ole Lensmar notifications@github.com wrote:

not yet - i'll fix it over the weekend - sorry to keep you waiting!

— Reply to this email directly or view it on GitHub https://github.com/olensmar/soapui-swagger-plugin/issues/3#issuecomment-94028926 .

Sebastián Ortiz Vásquez. 2015

olensmar commented 9 years ago

ok - i've dug in - the cause of this is that the Swagger parsers internally only support string values for the "default" property in your definitions - you have

... "billingAddress": { "default": null, "$ref": "#/definitions/BillingAddress" } ...

and later on

... "installments": { "type": "number", "description": "The amount of payments to divide the charge amount.", "minimum": 1, "maximum": 36, "default": 1 }, ...

If you remove default or give it a string value your definition loads ok. I'll follow up with the swagger team to see if I've understood this correctly.

/Ole