Share via


Create from OpenAPI specification not working

Question

Thursday, February 8, 2018 8:27 AM

Hi,

Today I noticed the notification about removing the publisher portal after Mar 1, 2018. This made me decide to not use the publisher portal anymore and use APIM from the normal Azure Portal.

In the Azure Portal I tried to “Create from OpenAPI specification” to create a new API based on the swagger file my API provides online. Unfortunately, it doesn’t work, I receive the following error:

"One or more fields contain incorrect values:

  • Please specify valid OpenAPI specification file."

In the publisher portal is it possible to create the API from the same file. The file is also accepted by the Swagger Error, it doesn’t report any error. If I download the JSON file and upload it, it works.

Although I have a workaround with the download and upload, it would be useful if  the import via URL is working.

Thanks!

All replies (7)

Thursday, February 8, 2018 10:39 AM ✅Answered

If you are receiving errors importing your Open API document, ensure you have validated it - either using the designer in the Azure portal (Design - Front End - Open API Specification Editor), or with a third-party tool such as Swagger Editor properly. For more information, refer this article: /fi-fi/azure/api-management/api-management-api-import-restrictions.

Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.


Monday, February 12, 2018 8:55 AM

In my original post I tried to say that I validated my schema with the Swagger Editor ( https://editor.swagger.io/  ) but I accidentally made an error and wrote "Swagger Error". My swagger  file is accepted by the editor, but now I see that there is no "host name" and "schemes" properties in my file. 

The API imported is giving an error in the Front End - Open API Specification Editor:

Swagger Error

The base path to the API. Example: '/api'.
Jump to line 5
Details
Object

On line 5 is the reference to my host: host: removedforprivacy.p.azurewebsites.net

No /api on this line. 

Now I have to see how to get the host name and the schemes properties in my Swagger file? This is not default behavior of "Swashbuckle.AspNetCore" I think.

Is this a change between the publisher portal and the Azure Portal?


Tuesday, February 13, 2018 7:26 PM

Do you use URL or local file to import an API? Is it possible to share this URL/file?


Tuesday, February 20, 2018 6:23 AM

When I use the URL import I got the "not valid" error.

Uploading the local (downloaded) file works, although APIM cannot export it in a valid way.

The file is not public available and I cannot share the contents, maybe I can create a "test" API and swagger file, but I have to see if that fits in my schedule (people are ill / on holiday :( ).


Tuesday, February 20, 2018 6:47 PM

Does your file contain schemas? If so, try removing them. If you it's possible for you to share APIM service name, it would help me to look into more detailed logs.


Monday, March 26, 2018 5:41 AM

Sorry for my late response, my team had some issues we had to address first.

It is now possible for me to import the swagger definition via the URL. My swagger file now contains host, basepath and schemes. The import via file is probably working because you then don't have any location the file is hosted and thus no location for the API.

I have marked your original answer again as answer. Still I think it is a pity that the functionality is now different than it was. Now the file has to be completely correct or you will get a generic error.


Tuesday, March 27, 2018 7:53 PM

Could you clarify a bit more which file works for you and which does not and under what conditions? If there is a regression we will address it.