Problem uploading swagger/openapi file
Asked by Jack Cox:

I've got a component defined and I'm trying to upload an openapi 3.0 spec file but things aren't working as expected. Here's what's going on:

1) If I drag and drop the openapi json file, things work as expected.

2) If I use the curl command to upload the file it only seems to work if there is no openapi spec already in place for that component.

3) If I upload a openapi spec via curl and there is already a spec in place I get a message that the upload was successful, but then any spec disappears from the Compass site. If I try to upload a 2nd time, it sometimes appears in Compass but usually does not.

This behavior make integration with my CI/CD pipeline (github actions) basically impossible.


Answers:
author: Matt Boulton
body: [@Jack Cox](/t5/user/viewprofilepage/user-id/4865142) @\[deleted\] we've made some [performance improvements to the Swagger UI app](https://community.atlassian.com/t5/Compass-Alpha-articles/Upgrade-your-Swagger-UI-app-for-improved-performance/ba-p/2145707) that should resolve this issue you're having. Just note that you'll need to upgrade the Swagger UI app on the Apps page in Compass, and then re-upload your Swagger files to your components.

If you still have this issue, or any other feedback about the app upgrade, let us know! Many thanks for your patience here.

(We're also working on improving the usability of the app, too. Keep an eye out for news on that soon.)

Cheers!

comments: author: David Harper
body: Hi [@Matt Boulton](/t5/user/viewprofilepage/user-id/4725612) ,

That looks like it is working now! Many thanks for your help on rebuilding that component; having all the Swagger in one place instead of having to deploy a developer portal is a really handy part of Compass.


author: Moinul
body: Hi Jack, Sorry for the late reply. I'm with the compass engineering team. When you upload via the webhook

1. it sometimes appears in Compass but usually does not -\> Do you still see the older version of the swagger file or it just disappears completely?

2. How often are you running those actions? I'm suspecting you might be getting rate limited by forge.

I'll report this issue in the backlog and will try to reproduce the issue locally.

comments: author: Jack Cox
body: 1) The older version goes away and there is no swagger there at all.

2) Initially I did run them fairly quickly back to back, but I tried again over the weekend, after many hours of idleness, and it still did nothing.

In all cases I get a positive response from the webhook that the swagger was accepted.


author: Moinul
body: Hi Jack thanks for the reply. I think we may have identified the problem. Could you tell us the size of the file you were trying to upload?


author: Jack Cox
body: The size of the file is 214004 bytes.

jack


author: Moinul
body: Hi Jack, I have filed a bug with the team for further investigation. We will post an update once we figure out a solution. Thanks!


author: David Harper
body: Hi [@Moinul](/t5/user/viewprofilepage/user-id/3468148) ,

If it's any help, we're noticing this too. A 41KB swagger file trying to upload via cURL.

The response says

```
{"message":"Successfully saved the swagger file"}%
```

and it appears in Compass for \~5 seconds before disappearing again and reverting back to the "We couldn't find a Swagger spec for this service" page.  

The Swagger file is version "2.0" and is generated via

```
 Microsoft.Azure.Functions.Worker.Extensions.OpenApi:1.2.0
```

in a C# project.


author: Katie Silver
body: Thanks so much for this detail [@David Harper](/t5/user/viewprofilepage/user-id/343001) and [@Jack Cox](/t5/user/viewprofilepage/user-id/4865142) . I'm the PM on Moinul's team. Mo and the squad originally built this as an innovation week project, so it makes sense we've hit some limitations now, but it's clearly useful, and we're glad it's gotten so much interest!

We're planning on investing some more focus on our roadmap to the Swagger app in the coming months to make it more stable and to add some additional functionality. Please keep adding feedback and I'll be in touch as soon as we have an update.


author: Jack Cox
body: [@Katie Silver](/t5/user/viewprofilepage/user-id/641274) and [@Moinul](/t5/user/viewprofilepage/user-id/3468148) Thanks for the feature. I think it has great potential, along with all of Compass.

From using it a bit I think some features that would be valuable for the Swagger integration:

1) Multiple swagger files. Not only because some services have multiple APIs, but because we have services running in different regions (prod, staging, dev, sandbox) with slightly different APIs.

2) A direct link on the component dashboard to the swagger(s) for that component.

There are other features that would be really valuable outside of swagger, but since this is a swagger thread I just included those.

Jack


Tags: api

swagger