From e0d3abf6eba2488e885cdae4afd2bfdd9fee2aec Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 14:56:11 -0400 Subject: [PATCH 01/11] Add alternative validator for testing --- .github/workflows/alt-validate.yml | 26 ++++++++++++++++++++++++++ .github/workflows/validate.yml | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 .github/workflows/alt-validate.yml diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml new file mode 100644 index 00000000..0f8d9e57 --- /dev/null +++ b/.github/workflows/alt-validate.yml @@ -0,0 +1,26 @@ +name: Alternate Validate sample queries +on: + workflow_dispatch: + +jobs: + validate-json-schema: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - name: Validate JSON schema + uses: walbo/validate-json@v1.1.0 + with: + schema: /tests/samples.schema.json + files: /sample-queries/sample-queries.json + + test: + runs-on: ubuntu-latest + needs: validate-json-schema + steps: + - uses: actions/checkout@v2 + + - name: Install + run: npm install + + - name: Run test + run: npm run test diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 26b670ff..e8ea79f4 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,5 +1,7 @@ name: Validate sample queries on: + workflow_dispatch: + push: paths: - sample-queries/sample-queries.json From 33764a58c6f5686330fe34ea558eacbdd14f3387 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:01:22 -0400 Subject: [PATCH 02/11] Update alt-validate.yml --- .github/workflows/alt-validate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml index 0f8d9e57..042f372b 100644 --- a/.github/workflows/alt-validate.yml +++ b/.github/workflows/alt-validate.yml @@ -1,6 +1,9 @@ name: Alternate Validate sample queries on: workflow_dispatch: + push: + branches: + - jasonjoh/json-validation jobs: validate-json-schema: From 87262fcbff076e038d648f7b66e0387eefd3c0a5 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:03:00 -0400 Subject: [PATCH 03/11] Update alt-validate.yml --- .github/workflows/alt-validate.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml index 042f372b..69cbf466 100644 --- a/.github/workflows/alt-validate.yml +++ b/.github/workflows/alt-validate.yml @@ -13,17 +13,5 @@ jobs: - name: Validate JSON schema uses: walbo/validate-json@v1.1.0 with: - schema: /tests/samples.schema.json - files: /sample-queries/sample-queries.json - - test: - runs-on: ubuntu-latest - needs: validate-json-schema - steps: - - uses: actions/checkout@v2 - - - name: Install - run: npm install - - - name: Run test - run: npm run test + schema: tests/samples.schema.json + files: sample-queries/sample-queries.json From bffd0d3f5acbd45fed95b979e1ab2c9f23073bc6 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:07:41 -0400 Subject: [PATCH 04/11] Update samples.schema.json --- tests/samples.schema.json | 140 +++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 71 deletions(-) diff --git a/tests/samples.schema.json b/tests/samples.schema.json index f89cf67a..a47bb19b 100644 --- a/tests/samples.schema.json +++ b/tests/samples.schema.json @@ -3,79 +3,77 @@ "properties": { "SampleQueries": { "type": "array", - "items": [ - { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "category": { - "type": "string" - }, - "method": { - "type": "string", - "enum": [ - "GET", - "POST", - "PUT", - "PATCH", - "DELETE" - ] - }, - "humanName": { - "type": "string" - }, - "requestUrl": { - "type": "string" - }, - "docLink": { - "type": "string", - "format": "uri" - }, - "tip": { - "type": "string" - }, - "postBody": { - "type": "string" - }, - "headers": { - "type": "array", - "items": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" - } + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uuid" + }, + "category": { + "type": "string" + }, + "method": { + "type": "string", + "enum": [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE" + ] + }, + "humanName": { + "type": "string" + }, + "requestUrl": { + "type": "string" + }, + "docLink": { + "type": "string", + "format": "uri" + }, + "tip": { + "type": "string" + }, + "postBody": { + "type": "string" + }, + "headers": { + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "additionalProperties": false, - "required": [ - "name", - "value" - ] - } - ] - }, - "skipTest": { - "type": "boolean" - } + "value": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } + ] }, - "additionalProperties": false, - "required": [ - "id", - "category", - "method", - "humanName", - "requestUrl", - "docLink" - ] - } - ] + "skipTest": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "id", + "category", + "method", + "humanName", + "requestUrl", + "docLink" + ] + } } }, "additionalProperties": false, From 8d3c6ecfd3752fa37c82b89c2c2b32a0f0938258 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:10:33 -0400 Subject: [PATCH 05/11] Update alt-validate.yml --- .github/workflows/alt-validate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml index 69cbf466..7da98aab 100644 --- a/.github/workflows/alt-validate.yml +++ b/.github/workflows/alt-validate.yml @@ -15,3 +15,4 @@ jobs: with: schema: tests/samples.schema.json files: sample-queries/sample-queries.json + schema-version: 2019-09 From f47ac94fb206061d88b876ae448c4c1cb9f1a2d4 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:23:19 -0400 Subject: [PATCH 06/11] Trying another validator --- .github/workflows/alt-validate.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml index 7da98aab..1b735cf0 100644 --- a/.github/workflows/alt-validate.yml +++ b/.github/workflows/alt-validate.yml @@ -11,8 +11,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: Validate JSON schema - uses: walbo/validate-json@v1.1.0 + uses: dsanders11/json-schema-validate-action@v1.4.0 with: schema: tests/samples.schema.json files: sample-queries/sample-queries.json - schema-version: 2019-09 From 9f00110b92612bb61229c7a9eebb4d01086e6156 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:23:53 -0400 Subject: [PATCH 07/11] Update samples.schema.json --- tests/samples.schema.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/samples.schema.json b/tests/samples.schema.json index a47bb19b..83f8e1e3 100644 --- a/tests/samples.schema.json +++ b/tests/samples.schema.json @@ -1,4 +1,5 @@ { + "$schema": "https://json-schema.org/draft/2019-09/schema", "type": "object", "properties": { "SampleQueries": { From aad353a87f6465f4ebe10d94d002aac64b888904 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:25:13 -0400 Subject: [PATCH 08/11] Update samples.schema.json --- tests/samples.schema.json | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/tests/samples.schema.json b/tests/samples.schema.json index 83f8e1e3..4bb0f95c 100644 --- a/tests/samples.schema.json +++ b/tests/samples.schema.json @@ -42,24 +42,22 @@ }, "headers": { "type": "array", - "items": [ - { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" - } + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "additionalProperties": false, - "required": [ - "name", - "value" - ] - } - ] + "value": { + "type": "string" + } + }, + "additionalProperties": false, + "required": [ + "name", + "value" + ] + } }, "skipTest": { "type": "boolean" From e20da310443d82f1b644a33aca556512ee8a4f08 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:26:42 -0400 Subject: [PATCH 09/11] Adding invalid property for testing --- sample-queries/sample-queries.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sample-queries/sample-queries.json b/sample-queries/sample-queries.json index 0265b513..293472f4 100644 --- a/sample-queries/sample-queries.json +++ b/sample-queries/sample-queries.json @@ -3668,7 +3668,7 @@ "postBody": "{\r\n \"@odata.type\": \"#microsoft.graph.windowsUpdates.contentApproval\",\r\n \"content\": {\r\n \"@odata.type\": \"#microsoft.graph.windowsUpdates.catalogContent\",\r\n \"catalogEntry\": {\r\n \"@odata.type\": \"#microsoft.graph.windowsUpdates.driverUpdateCatalogEntry\",\r\n \"id\": \"{catalogEntryId}\"\r\n }\r\n }\r\n}", "tip": "Please enable the WindowsUpdates.ReadWrite.All permission to use this query. To find a value for the updatePolicyId parameter, you can run: GET https://graph.microsoft.com/beta/admin/windows/updates/updatePolicies.", "skipTest": false - }, + }, { "id": "eba3d860-f13d-4eec-8cca-44b62507d67f", "category": "Windows Updates", @@ -4067,7 +4067,8 @@ "requestUrl": "/beta/employeeExperience/goals/exportJobs/{jobId}/content", "tip": "This query requires the Goals-Export.Read.All/Goals-Export.ReadWrite.All permission", "docLink": "https://learn.microsoft.com/en-us/graph/api/goalsexportjob-get?view=graph-rest-beta#example-6-get-the-content-of-a-successfully-completed-goalsexportjob-resource", - "skipTest": false + "skipTest": false, + "foo": "bar" } ] } From d7a4635d9466250e768f55c4b9241bde3dd7b9f9 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:40:47 -0400 Subject: [PATCH 10/11] Update sample-queries.json --- sample-queries/sample-queries.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sample-queries/sample-queries.json b/sample-queries/sample-queries.json index 293472f4..1a8fa5f2 100644 --- a/sample-queries/sample-queries.json +++ b/sample-queries/sample-queries.json @@ -7,6 +7,7 @@ "humanName": "my profile", "requestUrl": "/v1.0/me", "docLink": "https://docs.microsoft.com/en-us/graph/api/user-get", + "skipTest": false, "skipTest": false }, { @@ -4067,8 +4068,7 @@ "requestUrl": "/beta/employeeExperience/goals/exportJobs/{jobId}/content", "tip": "This query requires the Goals-Export.Read.All/Goals-Export.ReadWrite.All permission", "docLink": "https://learn.microsoft.com/en-us/graph/api/goalsexportjob-get?view=graph-rest-beta#example-6-get-the-content-of-a-successfully-completed-goalsexportjob-resource", - "skipTest": false, - "foo": "bar" + "skipTest": false } ] } From 5c734aa40eb336ee4d7e47c9496160891dc74e46 Mon Sep 17 00:00:00 2001 From: Jason Johnston Date: Fri, 29 Aug 2025 15:44:03 -0400 Subject: [PATCH 11/11] Replace JSON validator --- .github/workflows/alt-validate.yml | 17 ----------------- .github/workflows/validate.yml | 16 +++++++++------- sample-queries/sample-queries.json | 1 - 3 files changed, 9 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/alt-validate.yml diff --git a/.github/workflows/alt-validate.yml b/.github/workflows/alt-validate.yml deleted file mode 100644 index 1b735cf0..00000000 --- a/.github/workflows/alt-validate.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Alternate Validate sample queries -on: - workflow_dispatch: - push: - branches: - - jasonjoh/json-validation - -jobs: - validate-json-schema: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - - name: Validate JSON schema - uses: dsanders11/json-schema-validate-action@v1.4.0 - with: - schema: tests/samples.schema.json - files: sample-queries/sample-queries.json diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e8ea79f4..e8df9a73 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -9,6 +9,7 @@ on: - tests/** - package.json - package-lock.json + pull_request: paths: - sample-queries/sample-queries.json @@ -21,18 +22,19 @@ jobs: validate-json-schema: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Validate json schema - uses: docker://orrosenblatt/validate-json-action:latest - env: - INPUT_SCHEMA: /tests/samples.schema.json - INPUT_JSONS: /sample-queries/sample-queries.json + - uses: actions/checkout@v5 + + - name: Validate JSON schema + uses: dsanders11/json-schema-validate-action@v1.4.0 + with: + schema: tests/samples.schema.json + files: sample-queries/sample-queries.json test: runs-on: ubuntu-latest needs: validate-json-schema steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v5 - name: Install run: npm install diff --git a/sample-queries/sample-queries.json b/sample-queries/sample-queries.json index 1a8fa5f2..e75f5956 100644 --- a/sample-queries/sample-queries.json +++ b/sample-queries/sample-queries.json @@ -7,7 +7,6 @@ "humanName": "my profile", "requestUrl": "/v1.0/me", "docLink": "https://docs.microsoft.com/en-us/graph/api/user-get", - "skipTest": false, "skipTest": false }, {