You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/api-center/enable-api-analysis-linting.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.custom: devx-track-azurecli
15
15
This article explains how to enable API analysis in [Azure API Center](overview.md) by manually setting up a linting engine and triggers. API analysis offers linting capabilities to analyze API definitions in your organization's API center. Linting ensures your API definitions adhere to organizational style rules, generating both individual and summary reports. Use API analysis to identify and correct common errors and inconsistencies in your API definitions.
16
16
17
17
> [!NOTE]
18
-
> In preview, Azure API Center can also automatically set up a linting engine and any required dependencies and triggers. [Learn more](enable-managed-api-analysis-linting.md).
18
+
> In preview, Azure API Center automatically sets up a linting engine and any required dependencies and triggers. [Learn more](enable-managed-api-analysis-linting.md).
title: Managed API linting and analysis - Azure API Center
3
-
description: Enable managed linting of API definitions in your API center to analyze compliance of APIs with the organization's API style guide.
3
+
description: Automatic linting of API definitions in your API center helps you analyze compliance of APIs with the organization's API style guide.
4
4
ms.service: azure-api-center
5
5
ms.topic: how-to
6
-
ms.date: 11/01/2024
6
+
ms.date: 11/11/2024
7
7
ms.author: danlep
8
8
author: dlepow
9
9
ms.custom:
10
10
# Customer intent: As an API developer or API program manager, I want to analyze the API definitions in my organization's API center for compliance with my organization's API style guide.
11
11
---
12
12
13
-
# Enable API analysis in your API center - Microsoft managed
13
+
# Analyze APIs in your API center - Microsoft managed
14
14
15
-
This article explains how to enable API analysis in [Azure API Center](overview.md)without having to manage it yourself (preview). API analysis offers linting capabilities to analyze API definitions in your organization's API center. Linting ensures your API definitions adhere to organizational style rules, generating both individual and summary reports. Use API analysis to identify and correct common errors and inconsistencies in your API definitions.
15
+
Your organization's [API center](overview.md)includes built-in linting capabilities (preview)to analyze API definitions for adherence to organizational style rules, generating both individual and summary reports. API analysis identifies and helps you correct common errors and inconsistencies in your API definitions.
16
16
17
-
> [!IMPORTANT]
18
-
> Managed API analysis in API Center sets up a linting engine and necessary dependencies automatically. You can also enable linting and analysis [manually](enable-api-analysis-linting.md) using a custom Azure function. **Disable any function used for manual linting before enabling managed API analysis.**
17
+
With API analysis:
19
18
19
+
* Azure API Center automatically analyzes your API definitions whenever you add or update an API definition. API definitions are linted by default with a [spectral:oas ruleset](https://docs.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules) (API style guide).
20
+
* API analysis reports are generated in the Azure portal, showing how your API definitions conform to the style guide.
21
+
* You can use the Azure API Center extension for Visual Studio Code to customize and test your own API style guide locally and then deploy it to your API center.
20
22
21
-
In this scenario:
22
23
23
-
1. Add a linting ruleset (API style guide) in your API center using the Visual Studio Code extension for Azure API Center.
24
-
1. Azure API Center automatically runs linting when you add or update an API definition. It's also triggered for all API definitions when you deploy a ruleset to your API center.
25
-
1. Review API analysis reports in the Azure portal to see how your API definitions conform to the style guide.
26
-
1. Optionally customize the ruleset for your organization's APIs. Test the custom ruleset locally before deploying it to your API center.
24
+
> [!IMPORTANT]
25
+
> You can also enable linting and analysis [manually](enable-api-analysis-linting.md) using a custom Azure function. **Disable any function used for manual linting before using managed API analysis.**
27
26
28
27
## Limitations
29
28
30
29
* Currently, only OpenAPI specification documents in JSON or YAML format are analyzed.
31
-
* By default, you enable analysis with the [`spectral:oas` ruleset](https://docs.stoplight.io/docs/spectral/4dec24461f3af-open-api-rules). To learn more about the built-in rules, see the [Spectral GitHub repo](https://github.com/stoplightio/spectral/blob/develop/docs/reference/openapi-rules.md).
32
30
* Currently, you configure a single ruleset, and it's applied to all OpenAPI definitions in your API center.
33
31
* There are [limits](../azure-resource-manager/management/azure-subscription-service-limits.md?toc=/azure/api-center/toc.json&bc=/azure/api-center/breadcrumb/toc.json#api-center-limits) for the maximum number of API definitions analyzed. Analysis can take a few minutes to up to 24 hours to complete.
34
32
35
33
## Prerequisites
36
34
37
-
* An API center in your Azure subscription. If you haven't created one already, see [Quickstart: Create your API center](set-up-api-center.md).
38
-
*[Visual Studio Code](https://code.visualstudio.com/)
39
-
40
-
* The following Visual Studio Code extensions:
35
+
* An API center in your Azure subscription. If you haven't created one already, see [Quickstart: Create your API center](set-up-api-center.md).
36
+
* For customizing the ruleset, [Visual Studio Code](https://code.visualstudio.com/) and the following Visual Studio Code extensions:
41
37
*[Azure API Center extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=apidev.azure-api-center)
42
-
43
-
> [!IMPORTANT]
44
-
> Enable managed API analysis using the API Center extension's pre-release version. When installing the extension, choose the pre-release version. Switch between release and pre-release versions any time via the extension's **Manage** button in the Extensions view.
45
38
*[Spectral extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=stoplight.spectral)
46
39
47
-
## Enable API analysis using Visual Studio Code
48
-
49
-
To enable API analysis using the default linting ruleset:
50
-
51
-
1. In Visual Studio Code, open a folder that you'll use to manage rulesets for Azure API Center.
52
-
1. Select the Azure API Center icon from the Activity Bar.
53
-
1. In the API Center pane, expand the API center resource in which to enable API analysis.
54
-
1. Right-click **Rules** and select **Enable API Analysis**.
55
-
56
-
:::image type="content" source="media/enable-managed-api-analysis-linting/enable-analysis-visual-studio-code.png" alt-text="Screenshot of enabling API linting and analysis in Visual Studio Code.":::
57
-
58
-
A message notifies you after API analysis is successfully enabled. A folder for your API center is created in `.api-center-rules`, at the root of your working folder. The folder for your API center contains:
59
-
60
-
* A `ruleset.yml` file that defines the default API style guide used by the linting engine.
61
-
* A `functions` folder with an example custom function that you can use to extend the ruleset.
62
-
63
-
With analysis enabled, the linting engine analyzes API definitions in your API center based on the default ruleset and generates API analysis reports.
64
-
65
40
## View API analysis reports
66
41
67
42
View an analysis summary and the analysis reports for your API definitions in the Azure portal. After API definitions are analyzed, the reports list errors, warnings, and information based on the configured API style guide.
@@ -82,12 +57,13 @@ To view an analysis summary in your API center:
82
57
83
58
## Customize ruleset
84
59
85
-
You can customize the default ruleset or replace it as your organization's API style guide. For example, you can [extend the ruleset](https://docs.stoplight.io/docs/spectral/83527ef2dd8c0-extending-rulesets) or add [custom functions](https://docs.stoplight.io/docs/spectral/a781e290eb9f9-custom-functions).
60
+
You can use the Azure API Center extension for Visual Studio Code to customize the default ruleset for your API center or replace it as your organization's API style guide. For example, you can [extend the ruleset](https://docs.stoplight.io/docs/spectral/83527ef2dd8c0-extending-rulesets) or add [custom functions](https://docs.stoplight.io/docs/spectral/a781e290eb9f9-custom-functions).
86
61
87
62
To customize or replace the ruleset:
88
63
89
-
1. In Visual Studio Code, open the `.api-center-rules` folder at the root of your working folder.
90
-
1. In the folder for the API center resource, open the `ruleset.yml` file.
64
+
1. In Visual Studio Code, select the Azure API Center icon from the Activity Bar.
65
+
1. Open the `.api-center-rules` folder at the root of your working folder.
66
+
1. In the folder for your API center resource, open the `ruleset.yml` file.
91
67
1. Modify or replace the content as needed.
92
68
1. Save your changes to `ruleset.yml`.
93
69
@@ -121,4 +97,5 @@ To see the results of linting with the updated ruleset, view the API analysis re
121
97
122
98
## Related content
123
99
100
+
* To learn more about the default built-in ruleset, see the [Spectral GitHub repo](https://github.com/stoplightio/spectral/blob/develop/docs/reference/openapi-rules.md).
124
101
*[Enable API analysis in your API center - self-managed](enable-api-analysis-linting.md)
0 commit comments