Skip to content

Commit 3405439

Browse files
authored
Merge pull request #290032 from dlepow/apiccop
[APIC] Generate OpenAPI spec from prompt
2 parents 837c4cf + 91c03eb commit 3405439

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

articles/api-center/build-register-apis-vscode-extension.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: API developers can use the Azure API Center extension for Visual St
44
author: dlepow
55
ms.service: azure-api-center
66
ms.topic: how-to
7-
ms.date: 10/16/2024
7+
ms.date: 11/08/2024
88
ms.author: danlep
99
ms.collection: ce-skilling-ai-copilot
1010
ms.custom:
@@ -16,7 +16,8 @@ ms.custom:
1616
API developers in your organization can build and register APIs in your [API center](overview.md) inventory by using the Azure API Center extension for Visual Studio Code. API developers can:
1717

1818
* Add an existing API to an API center as a one-time operation, or integrate a development pipeline to register APIs as part of a CI/CD workflow.
19-
* Generate OpenAPI specification files from API code using GitHub Copilot, and register the API to an API center.
19+
* Use GitHub Copilot to generate new OpenAPI specs from API code.
20+
* Use natural language prompts with the API Center plugin for GitHub Copilot for Azure to create new OpenAPI specs.
2021

2122
API developers can also take advantage of features in the extension to [discover and consume APIs](discover-apis-vscode-extension.md) in the API center and ensure [API governance](govern-apis-vscode-extension.md).
2223

@@ -27,6 +28,7 @@ The following Visual Studio Code extensions are needed for the specified scenari
2728
* [GitHub Actions](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions) - to register APIs using a CI/CD pipeline with GitHub Actions
2829
* [Azure Pipelines](https://marketplace.visualstudio.com/items?itemName=ms-azure-devops.azure-pipelines) - to register APIs using a CI/CD pipeline with Azure Pipelines
2930
* [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) - to generate OpenAPI specification files from API code
31+
* [GitHub Copilot for Azure](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azure-github-copilot) - to generate OpenAPI specification files using the Azure API Center Plugin for GitHub Copilot for Azure
3032

3133
[!INCLUDE [vscode-extension-setup](includes/vscode-extension-setup.md)]
3234

@@ -51,9 +53,9 @@ The following steps register an API in your API center with a CI/CD pipeline. Wi
5153

5254
Learn more about setting up a [GitHub Actions workflow](register-apis-github-actions.md) to register APIs with your API center.
5355

54-
## Generate OpenAPI specification file from API code
56+
## Generate OpenAPI spec from API code
5557

56-
Use the power of GitHub Copilot with the Azure API Center extension for Visual Studio Code to create an OpenAPI specification file from your API code. Right-click on the API code, select **Copilot** from the options, and select **Generate API documentation**. GitHub Copilot creates an OpenAPI specification file.
58+
Use the power of [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) with the Azure API Center extension for Visual Studio Code to create an OpenAPI specification file from your API code. Right-click on the API code, select **Copilot** from the options, and select **Generate API documentation**. GitHub Copilot creates an OpenAPI specification file.
5759

5860
> [!NOTE]
5961
> This feature is available in the pre-release version of the API Center extension.
@@ -62,6 +64,33 @@ Use the power of GitHub Copilot with the Azure API Center extension for Visual S
6264

6365
After generating the OpenAPI specification file and checking for accuracy, you can register the API with your API center using the **Azure API Center: Register API** command.
6466

67+
## Generate OpenAPI spec using natural language prompts
68+
69+
The API Center plugin for [GitHub Copilot for Azure](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azure-github-copilot) helps you design new APIs starting from natural language prompts. With AI assistance, quickly generate an OpenAPI spec for API development that complies with your organization's standards.
70+
71+
> [!NOTE]
72+
> This feature is available in the pre-release version of the API Center extension.
73+
74+
1. If desired, set an active API style guide. Use the **Ctrl+Shift+P** keyboard shortcut to open the Command Palette. Type **Azure API Center: Set API Style Guide**, make a selection, and hit **Enter**.
75+
76+
If no style guide is set, the default `spectral:oas` ruleset is used.
77+
1. In the chat panel, make a request in natural language to the `@azure` agent to describe what the API does. Example:
78+
79+
```vscode
80+
@azure Generate OpenAPI spec: An API that allows customers to pay for an order using various payment methods such as cash, checks, credit cards, and debit cards.
81+
```
82+
83+
The agent responds with an OpenAPI specification document.
84+
85+
:::image type="content" source="media/build-register-apis-vscode-extension/generate-api-specification.png" alt-text="Screenshot showing how to use @azure extension to generate an OpenAPI spec from a prompt.":::
86+
87+
88+
1. Review the generated output for accuracy and compliance with your API style guide. Refine the prompt if needed to regenerate.
89+
90+
> [!TIP]
91+
> Effective prompts focus on an API's business requirements rather than implementation details. Shorter prompts sometimes work better than longer ones.
92+
1. When it meets your requirements, save the generated OpenAPI specification to a file.
93+
1. Register the API with your API center. Select **Register your API in API Center** button in the chat panel, or select **Azure API Center: Register API** from the Command Palette, and follow the prompts.
6594
6695
## Related content
6796
129 KB
Loading

0 commit comments

Comments
 (0)