Skip to content

Commit

Permalink
feat: add options.ignore to bypass validation
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Nov 24, 2024
1 parent df1e53d commit aae7c25
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ declare global {

interface Options {
autofix?: boolean
ignore?(data: any, schema: Schema): boolean
}

export interface Meta<T = any> {
Expand Down Expand Up @@ -346,6 +347,7 @@ Schema.extend = function extend(type, resolve) {

Schema.resolve = function resolve(data, schema, options = {}, strict = false) {
if (!schema) return [data]
if (options.ignore?.(data, schema)) return [data]

if (isNullable(data)) {
if (schema.meta.required) throw new TypeError(`missing required value`)
Expand Down

0 comments on commit aae7c25

Please sign in to comment.