Skip to content

Commit 8c5c438

Browse files
author
gitName
committed
[APIC] Default linting/analysis
1 parent c526e7b commit 8c5c438

File tree

2 files changed

+18
-41
lines changed

2 files changed

+18
-41
lines changed

articles/api-center/enable-api-analysis-linting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.custom: devx-track-azurecli
1515
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.
1616

1717
> [!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).
1919
2020
> [!VIDEO https://www.youtube.com/embed/m0XATQaVhxA]
2121
Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,42 @@
11
---
22
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.
44
ms.service: azure-api-center
55
ms.topic: how-to
6-
ms.date: 11/01/2024
6+
ms.date: 11/11/2024
77
ms.author: danlep
88
author: dlepow
99
ms.custom:
1010
# 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.
1111
---
1212

13-
# Enable API analysis in your API center - Microsoft managed
13+
# Analyze APIs in your API center - Microsoft managed
1414

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.
1616

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:
1918

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.
2022

21-
In this scenario:
2223

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.**
2726
2827
## Limitations
2928

3029
* 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).
3230
* Currently, you configure a single ruleset, and it's applied to all OpenAPI definitions in your API center.
3331
* 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.
3432

3533
## Prerequisites
3634

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:
4137
* [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.
4538
* [Spectral extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=stoplight.spectral)
4639

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-
6540
## View API analysis reports
6641

6742
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:
8257
8358
## Customize ruleset
8459

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).
8661

8762
To customize or replace the ruleset:
8863

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.
9167
1. Modify or replace the content as needed.
9268
1. Save your changes to `ruleset.yml`.
9369

@@ -121,4 +97,5 @@ To see the results of linting with the updated ruleset, view the API analysis re
12197

12298
## Related content
12399

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).
124101
* [Enable API analysis in your API center - self-managed](enable-api-analysis-linting.md)

0 commit comments

Comments
 (0)