Skip to content

Commit

Permalink
Warn on docs.microsoft.com (part 2) (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeharder authored Jan 22, 2025
1 parent c935b1a commit 008a630
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
7 changes: 7 additions & 0 deletions packages/rulesets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log - @microsoft.azure/openapi-validator-rulesets

## 2.1.5
Tue, 14 Feb 2025 19:10:00 GMT

### Patches

- [AvoidMsdnReferences] Fix addition of "docs.microsoft.com" to disallow list

## 2.1.4
Tue, 14 Feb 2025 19:10:00 GMT

Expand Down
10 changes: 5 additions & 5 deletions packages/rulesets/generated/spectral/az-arm.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ const avoidMsdnReferences = (swaggerObj, _opts, paths) => {
if (swaggerObj === null) {
return [];
}
if (typeof swaggerObj === "string" && !swaggerObj.includes("https://msdn.microsoft.com"))
if (typeof swaggerObj === "string" && !(swaggerObj.includes("https://msdn.microsoft.com") || swaggerObj.includes("https://docs.microsoft.com")))
return [];
if (typeof swaggerObj === "object") {
const docUrl = swaggerObj.url;
if (docUrl === undefined || !docUrl.startsWith("https://msdn.microsoft.com"))
if (docUrl === undefined || !(docUrl.startsWith("https://msdn.microsoft.com") || docUrl.startsWith("https://docs.microsoft.com")))
return [];
}
const path = paths.path || [];
return [{
message: 'For better generated code quality, remove all references to "msdn.microsoft.com".',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com" and "docs.microsoft.com".',
path,
}];
};
Expand Down Expand Up @@ -1277,8 +1277,8 @@ const ruleset$1 = {
},
},
AvoidMsdnReferences: {
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "docs.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com".',
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "learn.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" or "docs.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com" and "docs.microsoft.com".',
severity: "warn",
resolved: false,
formats: [oas2],
Expand Down
4 changes: 2 additions & 2 deletions packages/rulesets/generated/spectral/az-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -1031,8 +1031,8 @@ const ruleset = {
},
},
AvoidMsdnReferences: {
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "docs.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com".',
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "learn.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" or "docs.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com" and "docs.microsoft.com".',
severity: "warn",
resolved: false,
formats: [oas2],
Expand Down
4 changes: 2 additions & 2 deletions packages/rulesets/generated/spectral/az-dataplane.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,8 @@ const ruleset$1 = {
},
},
AvoidMsdnReferences: {
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "docs.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com".',
description: 'The documentation is being generated from the OpenAPI(swagger) and published at "learn.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" or "docs.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com" and "docs.microsoft.com".',
severity: "warn",
resolved: false,
formats: [oas2],
Expand Down
2 changes: 1 addition & 1 deletion packages/rulesets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft.azure/openapi-validator-rulesets",
"version": "2.1.4",
"version": "2.1.5",
"description": "Azure OpenAPI Validator",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions packages/rulesets/src/spectral/az-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ const ruleset: any = {
},
AvoidMsdnReferences: {
description:
'The documentation is being generated from the OpenAPI(swagger) and published at "docs.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com".',
'The documentation is being generated from the OpenAPI(swagger) and published at "learn.microsoft.com". From that perspective, documentation team would like to avoid having links to the "msdn.microsoft.com" or "docs.microsoft.com" in the OpenAPI(swagger) and SDK documentations.',
message: 'For better generated code quality, remove all references to "msdn.microsoft.com" and "docs.microsoft.com".',
severity: "warn",
resolved: false,
formats: [oas2],
Expand Down

0 comments on commit 008a630

Please # to comment.