From 4be2ab9a01dcba1e59bdfa2fec8ce329690c5964 Mon Sep 17 00:00:00 2001 From: Thomas Constantine Moore Date: Wed, 11 Sep 2024 15:26:38 -0400 Subject: [PATCH] update README --- .github/workflows/test.yml | 24 ++++++++++++------------ README.md | 26 ++++++++++++++++++-------- package.json | 2 +- src/main.ts | 2 -- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fe8816..b1dbea1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,6 @@ name: Test on: push jobs: - test: - name: Test Valid - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Test Local Action - uses: ./ - with: - schema-url: https://raw.githubusercontent.com/thomasmost/gha-valjean/main/schema/example.schema.json - target-dir: samples test_invalid: name: Test Invalid runs-on: ubuntu-latest @@ -29,4 +18,15 @@ jobs: if: (${{ success() }} || ${{ failure() }}) && (${{ steps.test_failure.outcome }} == 'failure') run: | echo "Validation failed as expected!" - exit 0 \ No newline at end of file + exit 0 + test: + name: Test Valid + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Test Local Action + uses: ./ + with: + schema-url: https://raw.githubusercontent.com/thomasmost/gha-valjean/main/schema/example.schema.json + target-dir: samples \ No newline at end of file diff --git a/README.md b/README.md index 3116d93..d00f63e 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,30 @@ -# quicktype-gha +# gha-valjean -A GitHub Action for generating type bindings from JSON schema files +A GitHub Action for validating JSON files against a remote schema + +On the backend, this uses AJV to perform the validation ## Inputs -### `source-file` +### `schema-url` + +Url to the remote schema JSON file to validate against + +### `target-dir` + +Comma-separated list directories to validate + +### `all-errors` (optional) -Schema JSON file to generate type bindings from. +Enables 'all errors' validation on AJV -### `out-langs` +### `ajv-strict` (optional) -Comma-separated list of language extensions to generate bindings for +Enables 'strict mode' in AJV -### `out-dir` (optional) +### `draft-version` (optional) -Directory to output generated bindings to +The JSON schema draft version (defaults to 2019)—only supports '2020' and '2019' ## Example Usage diff --git a/package.json b/package.json index 9cd683a..fdbc40e 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "author": "", "license": "ISC", "dependencies": { - "@actions/core": "^1.10.1", + "@actions/core": "^1.10.1,", "@actions/github": "^6.0.0", "@vercel/ncc": "^0.38.1", "ajv": "^8.16.0" diff --git a/src/main.ts b/src/main.ts index ff2707e..cfa4ddb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,8 +4,6 @@ import * as fs from "fs"; import Ajv2019 from "ajv" import Ajv2020 from 'ajv/dist/2020' - - /** * The main function for the action. * @returns {Promise} Resolves when the action is complete.