diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 26b670ff..e8df9a73 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 @@ -7,6 +9,7 @@ on: - tests/** - package.json - package-lock.json + pull_request: paths: - sample-queries/sample-queries.json @@ -19,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 0265b513..e75f5956 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", diff --git a/tests/samples.schema.json b/tests/samples.schema.json index f89cf67a..4bb0f95c 100644 --- a/tests/samples.schema.json +++ b/tests/samples.schema.json @@ -1,81 +1,78 @@ { + "$schema": "https://json-schema.org/draft/2019-09/schema", "type": "object", "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" - } - }, - "additionalProperties": false, - "required": [ - "name", - "value" - ] + "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" } + }, + "additionalProperties": false, + "required": [ + "name", + "value" ] - }, - "skipTest": { - "type": "boolean" } }, - "additionalProperties": false, - "required": [ - "id", - "category", - "method", - "humanName", - "requestUrl", - "docLink" - ] - } - ] + "skipTest": { + "type": "boolean" + } + }, + "additionalProperties": false, + "required": [ + "id", + "category", + "method", + "humanName", + "requestUrl", + "docLink" + ] + } } }, "additionalProperties": false,