From 183ed4da91716be574f2d603f8e4a49a3bd2e097 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 05:41:34 +0000 Subject: [PATCH 1/8] [contoso] Test readme.md without input files --- .../resource-manager/readme.md | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/specification/contosowidgetmanager/resource-manager/readme.md b/specification/contosowidgetmanager/resource-manager/readme.md index ae912e6ab9b0..58bb9bc2f7e2 100644 --- a/specification/contosowidgetmanager/resource-manager/readme.md +++ b/specification/contosowidgetmanager/resource-manager/readme.md @@ -3,18 +3,6 @@ > see https://aka.ms/autorest This is the AutoRest configuration file for Contoso. -## Getting Started - -To build the SDKs for My API, simply install AutoRest via `npm` (`npm install -g autorest`) and then run: - -> `autorest readme.md` -To see additional help and options, run: - -> `autorest --help` -For other options on installation see [Installing AutoRest](https://aka.ms/autorest/install) on the AutoRest github page. - ---- - ## Configuration ### Basic Information @@ -24,25 +12,4 @@ These are the global settings for the containerstorage. ```yaml openapi-type: arm openapi-subtype: rpaas -tag: package-2021-11-01 -``` - -### Tag: package-2021-11-01 - -These settings apply only when `--tag=package-2021-11-01` is specified on the command line. - -```yaml $(tag) == 'package-2021-11-01' -input-file: - - Microsoft.Contoso/stable/2021-11-01/contoso.json -``` - -### Tag: package-2021-10-01-preview - -These settings apply only when `--tag=package-2021-10-01-preview` is specified on the command line. - -```yaml $(tag) == 'package-2021-10-01-preview' -input-file: - - Microsoft.Contoso/preview/2021-10-01-preview/contoso.json -``` - ---- +``` \ No newline at end of file From 0ca2587e9d347ea8905ebf26dbf0234e4617fe47 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Tue, 10 Jun 2025 17:17:35 +0000 Subject: [PATCH 2/8] Empty commit to reset CI From e804b25d15b85b107fa30221b76220d2dcfecd68 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 17:30:23 +0000 Subject: [PATCH 3/8] Revert "[LintDiff] Skip readme.md files with no "input-file:" string (#35174)" This reverts commit fc12f4e13c3ce328372237147d4d7438ed980c72. --- eng/tools/lint-diff/src/processChanges.ts | 11 +---------- .../specification/no-input-file/readme.md | 13 ------------- eng/tools/lint-diff/test/processChanges.test.ts | 9 --------- 3 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md diff --git a/eng/tools/lint-diff/src/processChanges.ts b/eng/tools/lint-diff/src/processChanges.ts index d1a29c184934..6824683d5776 100644 --- a/eng/tools/lint-diff/src/processChanges.ts +++ b/eng/tools/lint-diff/src/processChanges.ts @@ -135,18 +135,9 @@ export async function buildState( // For readme files that have changed but there are no affected swaggers, // add them to the map with no tags for (const changedReadme of existingChangedFiles.filter(readme)) { - const readmePath = resolve(rootPath, changedReadme); - - // Skip readme.md files that don't have "input-file:" as autorest cannot - // scan them. - const readmeContent = await readFile(readmePath, { encoding: "utf-8" }); - if (!readmeContent.includes("input-file:")) { - continue; - } - const service = specModels.get(getService(changedReadme))!; const readmes = await service.getReadmes(); - const readmeObject = readmes.get(readmePath)!; + const readmeObject = readmes.get(resolve(rootPath, changedReadme))!; if (!changedFileAndTagsMap.has(changedReadme)) { changedFileAndTagsMap.set(changedReadme, { diff --git a/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md b/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md deleted file mode 100644 index 38902d5bade1..000000000000 --- a/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md +++ /dev/null @@ -1,13 +0,0 @@ -# Widget - -> see https://aka.ms/autorest -> This is the AutoRest configuration file for Widget. - -## Configuration - -Required if any services under this folder are RPaaS. - -```yaml -openapi-type: arm -openapi-subtype: rpaas -``` \ No newline at end of file diff --git a/eng/tools/lint-diff/test/processChanges.test.ts b/eng/tools/lint-diff/test/processChanges.test.ts index 294f4c3c5de1..5fad4a37997f 100644 --- a/eng/tools/lint-diff/test/processChanges.test.ts +++ b/eng/tools/lint-diff/test/processChanges.test.ts @@ -249,13 +249,4 @@ describe("buildState", () => { ), ).not.toThrow(); }); - - test.skipIf(isWindows())("does not include readme files that has no input-file:", async () => { - const actual = await buildState( - ["specification/no-input-file/readme.md"], - "test/fixtures/buildState/", - ); - - expect(actual).toEqual([new Map(), []]); - }); }); From 96f4f5a3c36266190233cbcec3ab4755f5218b43 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 17:31:15 +0000 Subject: [PATCH 4/8] Reapply "[LintDiff] Skip readme.md files with no "input-file:" string (#35174)" This reverts commit e804b25d15b85b107fa30221b76220d2dcfecd68. --- eng/tools/lint-diff/src/processChanges.ts | 11 ++++++++++- .../specification/no-input-file/readme.md | 13 +++++++++++++ eng/tools/lint-diff/test/processChanges.test.ts | 9 +++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md diff --git a/eng/tools/lint-diff/src/processChanges.ts b/eng/tools/lint-diff/src/processChanges.ts index 6824683d5776..d1a29c184934 100644 --- a/eng/tools/lint-diff/src/processChanges.ts +++ b/eng/tools/lint-diff/src/processChanges.ts @@ -135,9 +135,18 @@ export async function buildState( // For readme files that have changed but there are no affected swaggers, // add them to the map with no tags for (const changedReadme of existingChangedFiles.filter(readme)) { + const readmePath = resolve(rootPath, changedReadme); + + // Skip readme.md files that don't have "input-file:" as autorest cannot + // scan them. + const readmeContent = await readFile(readmePath, { encoding: "utf-8" }); + if (!readmeContent.includes("input-file:")) { + continue; + } + const service = specModels.get(getService(changedReadme))!; const readmes = await service.getReadmes(); - const readmeObject = readmes.get(resolve(rootPath, changedReadme))!; + const readmeObject = readmes.get(readmePath)!; if (!changedFileAndTagsMap.has(changedReadme)) { changedFileAndTagsMap.set(changedReadme, { diff --git a/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md b/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md new file mode 100644 index 000000000000..38902d5bade1 --- /dev/null +++ b/eng/tools/lint-diff/test/fixtures/buildState/specification/no-input-file/readme.md @@ -0,0 +1,13 @@ +# Widget + +> see https://aka.ms/autorest +> This is the AutoRest configuration file for Widget. + +## Configuration + +Required if any services under this folder are RPaaS. + +```yaml +openapi-type: arm +openapi-subtype: rpaas +``` \ No newline at end of file diff --git a/eng/tools/lint-diff/test/processChanges.test.ts b/eng/tools/lint-diff/test/processChanges.test.ts index 5fad4a37997f..294f4c3c5de1 100644 --- a/eng/tools/lint-diff/test/processChanges.test.ts +++ b/eng/tools/lint-diff/test/processChanges.test.ts @@ -249,4 +249,13 @@ describe("buildState", () => { ), ).not.toThrow(); }); + + test.skipIf(isWindows())("does not include readme files that has no input-file:", async () => { + const actual = await buildState( + ["specification/no-input-file/readme.md"], + "test/fixtures/buildState/", + ); + + expect(actual).toEqual([new Map(), []]); + }); }); From 13ce48785fb2dc82e281e68e284bdff06308d0b9 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 17:45:18 +0000 Subject: [PATCH 5/8] empty commit From 176112e9a5ba24e75f0b6906477187ecf3533406 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 18:13:56 +0000 Subject: [PATCH 6/8] empty commit From 4d737fb9da191f713af383f653e599b4ec6d6c61 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 18:48:09 +0000 Subject: [PATCH 7/8] empty commit From e44f7fc05d22ac49694fafcbf38e7080c7df1d39 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Tue, 10 Jun 2025 19:11:35 +0000 Subject: [PATCH 8/8] empty commit