How-To
When trying to create an API in APIM you may get an error during import
In this how-to, I will cover a workaround to fix this issue. In this case we are referring to the Azure Open AI Swagger files found here.
Steps to reproduce the issue
- Navigate to API Management Services in the Azure Portal
- Next, click on + Add API
- Under Create from definition you will see OpenAI click on it. The Create from OpenAPI specification dialog will appear.
- Next, click on Select a file and select one of the Swagger files you downloaded from here
You will get an error message that states: One or more fields contains incorrect values. Below is an example of the error.
Steps to workaround the issue.
The workaround is very simple. You create a blank API, then you import the Swagger. Here are the exact steps to fix this issue.
- Navigate to API Management Services in the Azure Portal
- Next, click on + Add API
- Under Define a new API click on HTTP, this will open the Create an HTTP API
- In the Display Name field enter Azure Open AI Demo and click on Create as depicted in the image below
At this point, you will have a blank API. Now, we need to import the Swagger for this blank API, below at the steps.
- Click on the … located to the right of the API.
- A context menu will appear, now click on Import
- You will see a blade open to the right labeled as Import API and below this you see OpenAI, click on it. This will open the *Import from OpenAPI specification dialog.
- Next, click on Select a File and select the Swagger file you would like to import, then click on Import
At this point all the operations will be created based on the Swagger file you just imported. Below is an example of what the operations may look like after following these steps.
Closing Summary
This issue has been reported so if you are not experiencing this issue, it means it has been fixed.