Error while Importing Swagger

mrios
New Member

Hello, I'm trying to import the swagger documentation for a dummy service [1] in our Developer Portal (on-premise Version: OPDK-4.15.04.01)

The error that I have when I try this operation is this one:

>>>>>>>>
POST /v1/o/internal/apimodels/8d844c46-5802-4300-866f-bed163053cd0/revisions?action=import&format=swagger HTTP/1.1
Host: internal.com:8443
accept: application/json; charset=utf-8
Content-Type: text/plain; charset=utf-8
User-Agent: DevPortal/4.15.04.01 Guzzle/3.9.3 curl/7.19.7 PHP/5.3.3
Referer: https://internal.com/admin/smartdocs/models/8d844c46-5802-4300-866f-bed163053cd0/import
Authorization: Basic [**masked**]
Content-Length: 54


URL=http://internal.com:28000/api-docs
<<<<<<<<
HTTP/1.1 500 Server Error
Content-Type: application/json
Date: Mon, 27 Jul 2015 19:08:08 GMT
Content-Length: 71


{
  "message" : "io/swagger/parser/SwaggerParser",
  "contexts" : [ ]
}
--------

I guess the error is while parsing the Swagger information. However, I'm able to import this Swagger JSON url using the cloud version. Something I notice is that on the cloud the smartdocs module use the version 7.x-5.1 and on our Dev Portal we are using the 7.x-4.4

Do you think the version of the Smartdocs module can be the cause of this problem?

Also, we are able to import the Yahoo Weather Api with WADL and send request throught smartdocs.

Thanks, Matias

[1] https://desolate-earth-6003.herokuapp.com/rest/api-docs The service has low memory assigned so sometimes is slow but it works.

0 3 1,028
3 REPLIES 3

Hi @Matias 4.15.04.01 supports Oauth 1.2 whereas in cloud it has already been updated to swagger 2.0.

Swagger 2.0 support in OPDK is supposed to come out very soon.

Keep checking this space : http://apigee.com/docs/release-notes/content/apigee-release-notes.

Subscribe to the release-notifications here : http://apigee.com/docs/release-notes/content/get-release-notifications

That example is swagger 1.2. I don't see how Swagger 2.0 is relevant to the question. Here's the stack trace when importing:

==> /opt/apigee4/var/log/apigee/management-server/logs/system.log <==

2015-07-29 14:52:58,114 org:MyEnv env: qtp995807706-53986 INFO  APIMODEL.COMMON - ApiRevisionResource.addApiDescription() : In ApiRevisionResource.addApiDescription(). Importing Swagger 
2015-07-29 14:52:58,115 org:MyEnv env: qtp995807706-53986 ERROR REST - CustomJAXRSInvoker.performInvocation()
 : CustomJAXRSInvoker.performInvocation : Method 
com.apigee.apimodel.repo.resource.ApiRevisionResource.addApiDescription 
threw an exception. 
2015-07-29 14:52:58,115 org:MyEnv env: qtp995807706-53986 ERROR REST - ExceptionMapper.toResponse() : Error occurred : io/swagger/parser/SwaggerParser
        

        com.apigee.apimodel.repo.persistence.service.impl.SwaggerBuilder.digestSwaggerDescription(SwaggerBuilder.java:87)
        com.apigee.apimodel.repo.persistence.service.impl.SwaggerBuilder.digestSwagger(SwaggerBuilder.java:76)
        com.apigee.apimodel.repo.resource.ApiRevisionResource.addApiDescription(ApiRevisionResource.java:130)
        sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Looking at the stack trace it seems that something is broken with the description field?

mrios
New Member

Thanks @sarthak for the quick answer.

I'm using the Swagger version 1.2 in the service and I think there are not Swagger 2.0 features in it.

So, how can I make that same service works in the OPDK? I mean, Is there a workaround for this situation?

Thanks