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-managed-api-analysis-linting.md
+35-22Lines changed: 35 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ To view an analysis summary in your API center:
56
56
57
57
> [!TIP]
58
58
> You can also view the API analysis report by selecting **Analysis** from the API definition's menu bar.
59
-
59
+
<!--
60
60
## Customize ruleset
61
61
62
62
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).
@@ -68,6 +68,37 @@ To customize or replace the ruleset:
68
68
1. In the folder for your API center resource, open the `ruleset.yaml` file.
69
69
1. Modify or replace the content as needed.
70
70
1. Save your changes to `ruleset.yaml`.
71
+
-->
72
+
73
+
## Analysis profiles
74
+
75
+
Azure API Center uses *analysis profiles* for linting and analyzing APIs. An analysis profile specifies a ruleset and optionally filter conditions for APIs that are analyzed. A default profile applies the `spectral:oas` ruleset to all OpenAPI and AsyncAPI definitions.
76
+
77
+
You can customize the ruleset and define filter conditions in the default profile, or you can create a new profile. For example, you might want to use one profile for APIs that are in development and a different one for APIs that are in production.
78
+
79
+
> [!NOTE]
80
+
> In the Standard plan of API Center, you can create up to 3 analysis profiles. Only a single default profile is supported in the Free plan.
81
+
82
+
To create an analysis profile:
83
+
84
+
1. In the Azure portal, navigate to your API center.
85
+
1. In the left-hand menu, under **Governance**, select **API Analysis** > **Manage analysis profiles** > **+ Create analysis profile**.
86
+
1. In the **Create new analysis profile** pane, enter a **Name** and **Description** for the profile.
87
+
1. In **Ruleset**, the analyzer type (linting engine) for the ruleset appears. Currently only Spectral is supported.
88
+
1. Under **Define filter conditions**, add one or more filter conditions for API definitions that the profile is applied to.
89
+
1. Select **Create**.
90
+
91
+
The profile is created and a ruleset scaffold is created.
92
+
93
+
### Customize the profile's ruleset
94
+
95
+
Use the Visual Studio Code extension for Azure API Center to customize a profile's ruleset. After customizing the ruleset and testing it locally, you can deploy it back to your API center.
96
+
97
+
1. In Visual Studio Code, select the Azure API Center icon from the Activity Bar.
98
+
1. In the API Center pane, expand the API center resource you are working with, and expand **Profiles**.
99
+
1. Expand the profile you want to modify, and select `ruleset.yaml`.
100
+
1. Modify or replace the content as needed.
101
+
1. Save your changes to `ruleset.yaml`.
71
102
72
103
### Test ruleset locally
73
104
@@ -94,31 +125,13 @@ To deploy the custom ruleset to your API center:
94
125
95
126
1. In Visual Studio Code, select the Azure API Center icon from the Activity Bar.
96
127
1. In the API Center pane, expand the API center resource in which you customized the ruleset.
97
-
1. Right-click **Rules** and select **Deploy Rules to API Center**.
128
+
1. Expand **Profiles**.
129
+
1. Right-click the profile in which you customized the ruleset, and select **Deploy Rules to API Center**.
98
130
99
-
A message notifies you after the rules are successfully deployed to your API center. The linting engine uses the updated ruleset to analyze API definitions.
131
+
A message notifies you after the rules are successfully deployed to your API center. The linting engine uses the updated ruleset to analyze API definitions in the profile.
100
132
101
133
To see the results of linting with the updated ruleset, view the API analysis reports in the portal.
102
134
103
-
## Analysis profiles
104
-
105
-
You can create multiple analysis profiles to use different rulesets with different APIs. For example, you might want to use one profile for APIs that are in development and a different one for APIs that are in production. The profiles
106
-
107
-
To create an analysis profile:
108
-
109
-
1. In the Azure portal, navigate to your API center.
110
-
1. In the left-hand menu, under **Governance**, select **API Analysis**.
111
-
1. In the API analysis summary, select **Manage analysis profiles** > **+ Create analysis profile**.
112
-
1. In the **Create new analysis profile** pane, enter a **Name** and **Description** for the profile.
113
-
1. In **Ruleset**, select the analyzer type (linting engine) for the ruleset. Currently only Spectral is supported.
114
-
1. Under **Define filter conditions**, add one or more filter conditions for the profile.
115
-
1. Select **Create**.
116
-
117
-
To modify the ruleset:
118
-
119
-
1. In the Azure portal, navigate to your API center.
120
-
121
-
122
135
## Related content
123
136
124
137
* 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).
0 commit comments