2
votes

I've just installed WSO2 2.0.0 (as far as I know, this is the version following v1.9.0, not a breaking compatibility version). I'm using it via Firefox 40.0.2 on Windows.

When I try to add a new API via "I have an existing API" menu, whatever I do, it always open an empty design API screen : https://localhost:9443/publisher/design

In this screen, when I try to import an API (swagger file or swagger URL), it just does nothing without prompting any error. My swagger file respects Swagger API 2.0 spec and corresponds to an API already used in production.

What should I do to get at least a useful error message regarding this API import ? (if it's installing an other version of WSO2, it's a valid answer for me.).

Here is the Swagger file I try to import :

    {
   "apiVersion":"2.0",
   "swaggerVersion":"1.2",
   "basePath":"/ValoConso/rest",
   "resourcePath":"/valoConsoWebService",
   "apis":[
      {
         "path":"/valoConsoElec",
         "operations":[
            {
               "method":"POST",
               (...)
            }
         ]
      }
   ],
   "models":{
      (...)
   }
}
1
Can you please check whether you are getting any browser console errors? Eg: "Uncaught TypeError: Cannot convert undefined or null to object"Malintha
In Firefox, I have no error, only warnings about the SHA-1 certificate. I've just tried in Chrome, and I have the message u mention, coming from this js line : "if(Object.keys(this.api_doc.paths).length == 0)" in api-design.js. So is it a known bug from WSO2 ?Tristan
Also, when I try to import the suggested example : petstore.swagger.io/v2/swagger.json, the import button turns into "saving" and then everything freezes (no error in console). Should I just throw this 2.0.0 version which is too young to be usable ?Tristan

1 Answers

0
votes

It seems the swagger document you are trying to import is of swagger version 1.2 ("swaggerVersion":"1.2"). From API Manager 1.9 onwards we should use swagger 2.0 compatible definitions.

You can use http://editor.swagger.io/#/ to validate your swagger definition according to 2.0 specification. Please try converting it according to 2.0 specification and then import to API Manager 2.0.

See some useful resources:

[1] Swagger 2.0 samples : https://github.com/OAI/OpenAPI-Specification/tree/master/examples/v2.0/json

[2] Swagger 1.2 -> 2.0 migration guide: https://github.com/OAI/OpenAPI-Specification/wiki/swagger-1.2-to-2.0-migration-guide