@@ -7,25 +7,25 @@ import * as core from '@actions/core';
77import * as glob from '@actions/glob' ;
88import * as http from '@actions/http-client' ;
99
10- import type { default as Ajv , ErrorObject } from 'ajv' ;
10+ import type { default as Ajv , ErrorObject , Options } from 'ajv' ;
1111import { default as Ajv2019 } from 'ajv/dist/2019' ;
1212import { default as Ajv2020 } from 'ajv/dist/2020' ;
1313import AjvDraft04 from 'ajv-draft-04' ;
1414import AjvFormats from 'ajv-formats' ;
1515import * as yaml from 'yaml' ;
1616
17- function newAjv ( schema : Record < string , unknown > ) : Ajv {
17+ function newAjv ( schema : Record < string , unknown > , options : Options ) : Ajv {
1818 const draft04Schema =
1919 schema . $schema === 'http://json-schema.org/draft-04/schema#' ;
2020 const draft2020Schema =
2121 schema . $schema === 'https://json-schema.org/draft/2020-12/schema' ;
2222
2323 const ajv = AjvFormats (
2424 draft04Schema
25- ? new AjvDraft04 ( )
25+ ? new AjvDraft04 ( options )
2626 : draft2020Schema
27- ? new Ajv2020 ( )
28- : new Ajv2019 ( )
27+ ? new Ajv2020 ( options )
28+ : new Ajv2019 ( options )
2929 ) ;
3030
3131 if ( ! draft04Schema && ! draft2020Schema ) {
@@ -46,6 +46,7 @@ export async function run(): Promise<void> {
4646 try {
4747 let schemaPath = core . getInput ( 'schema' , { required : true } ) ;
4848 const files = core . getMultilineInput ( 'files' , { required : true } ) ;
49+ const allErrors = core . getBooleanInput ( 'all-errors' ) ;
4950 const cacheRemoteSchema = core . getBooleanInput ( 'cache-remote-schema' ) ;
5051 const failOnInvalid = core . getBooleanInput ( 'fail-on-invalid' ) ;
5152
@@ -108,7 +109,7 @@ export async function run(): Promise<void> {
108109 validate = async ( data : Record < string , unknown > ) => {
109110 // Create a new Ajv instance per-schema since
110111 // they may require different draft versions
111- const ajv = newAjv ( data ) ;
112+ const ajv = newAjv ( data , { allErrors } ) ;
112113
113114 await ajv . validateSchema ( data ) ;
114115 return ajv . errors || [ ] ;
@@ -129,7 +130,7 @@ export async function run(): Promise<void> {
129130 return ;
130131 }
131132
132- const ajv = newAjv ( schema ) ;
133+ const ajv = newAjv ( schema , { allErrors } ) ;
133134
134135 validate = async ( data : object ) => {
135136 ajv . validate ( schema , data ) ;
0 commit comments