@hookform/resolvers 3.9.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +77 -8
  2. package/ajv/dist/ajv.js +1 -1
  3. package/ajv/dist/ajv.js.map +1 -1
  4. package/ajv/dist/ajv.mjs +1 -1
  5. package/ajv/dist/ajv.modern.mjs +1 -1
  6. package/ajv/dist/ajv.modern.mjs.map +1 -1
  7. package/ajv/dist/ajv.module.js +1 -1
  8. package/ajv/dist/ajv.module.js.map +1 -1
  9. package/ajv/dist/ajv.umd.js +1 -1
  10. package/ajv/dist/ajv.umd.js.map +1 -1
  11. package/ajv/dist/types.d.ts +8 -0
  12. package/ajv/src/__tests__/__fixtures__/data-errors.ts +216 -0
  13. package/ajv/src/__tests__/__snapshots__/ajv-errors.ts.snap +462 -0
  14. package/ajv/src/__tests__/__snapshots__/ajv.ts.snap +6 -6
  15. package/ajv/src/__tests__/ajv-errors.ts +227 -0
  16. package/ajv/src/ajv.ts +27 -14
  17. package/ajv/src/types.ts +8 -0
  18. package/arktype/dist/arktype.js +1 -1
  19. package/arktype/dist/arktype.js.map +1 -1
  20. package/arktype/dist/arktype.mjs +1 -1
  21. package/arktype/dist/arktype.modern.mjs +1 -1
  22. package/arktype/dist/arktype.modern.mjs.map +1 -1
  23. package/arktype/dist/arktype.module.js +1 -1
  24. package/arktype/dist/arktype.module.js.map +1 -1
  25. package/arktype/dist/arktype.umd.js +1 -1
  26. package/arktype/dist/arktype.umd.js.map +1 -1
  27. package/arktype/dist/types.d.ts +1 -1
  28. package/arktype/package.json +1 -1
  29. package/arktype/src/__tests__/Form-native-validation.tsx +3 -3
  30. package/arktype/src/__tests__/Form.tsx +2 -2
  31. package/arktype/src/__tests__/__fixtures__/data.ts +1 -1
  32. package/arktype/src/__tests__/__snapshots__/arktype.ts.snap +22 -415
  33. package/arktype/src/arktype.ts +17 -6
  34. package/arktype/src/types.ts +1 -1
  35. package/class-validator/dist/class-validator.js +1 -1
  36. package/class-validator/dist/class-validator.js.map +1 -1
  37. package/class-validator/dist/class-validator.mjs +1 -1
  38. package/class-validator/dist/class-validator.modern.mjs +1 -1
  39. package/class-validator/dist/class-validator.modern.mjs.map +1 -1
  40. package/class-validator/dist/class-validator.module.js +1 -1
  41. package/class-validator/dist/class-validator.module.js.map +1 -1
  42. package/class-validator/dist/class-validator.umd.js +1 -1
  43. package/class-validator/dist/class-validator.umd.js.map +1 -1
  44. package/class-validator/dist/types.d.ts +1 -1
  45. package/class-validator/src/__tests__/class-validator.ts +1 -1
  46. package/class-validator/src/class-validator.ts +1 -1
  47. package/class-validator/src/types.ts +1 -1
  48. package/dist/resolvers.js +1 -1
  49. package/dist/resolvers.js.map +1 -1
  50. package/dist/resolvers.mjs +1 -1
  51. package/dist/resolvers.mjs.map +1 -1
  52. package/dist/resolvers.module.js +1 -1
  53. package/dist/resolvers.module.js.map +1 -1
  54. package/dist/resolvers.umd.js +1 -1
  55. package/dist/resolvers.umd.js.map +1 -1
  56. package/effect-ts/dist/effect-ts.js +1 -1
  57. package/effect-ts/dist/effect-ts.js.map +1 -1
  58. package/effect-ts/dist/effect-ts.mjs +1 -1
  59. package/effect-ts/dist/effect-ts.modern.mjs +1 -1
  60. package/effect-ts/dist/effect-ts.modern.mjs.map +1 -1
  61. package/effect-ts/dist/effect-ts.module.js +1 -1
  62. package/effect-ts/dist/effect-ts.module.js.map +1 -1
  63. package/effect-ts/dist/effect-ts.umd.js +1 -1
  64. package/effect-ts/dist/effect-ts.umd.js.map +1 -1
  65. package/effect-ts/dist/types.d.ts +2 -2
  66. package/effect-ts/package.json +1 -2
  67. package/effect-ts/src/__tests__/Form-native-validation.tsx +3 -3
  68. package/effect-ts/src/__tests__/Form.tsx +3 -3
  69. package/effect-ts/src/__tests__/__fixtures__/data.ts +2 -2
  70. package/effect-ts/src/__tests__/__snapshots__/effect-ts.ts.snap +35 -1
  71. package/effect-ts/src/__tests__/effect-ts.ts +61 -0
  72. package/effect-ts/src/effect-ts.ts +37 -10
  73. package/effect-ts/src/types.ts +2 -2
  74. package/io-ts/dist/io-ts.js +1 -1
  75. package/io-ts/dist/io-ts.js.map +1 -1
  76. package/io-ts/dist/io-ts.mjs +1 -1
  77. package/io-ts/dist/io-ts.modern.mjs +1 -1
  78. package/io-ts/dist/io-ts.modern.mjs.map +1 -1
  79. package/io-ts/dist/io-ts.module.js +1 -1
  80. package/io-ts/dist/io-ts.module.js.map +1 -1
  81. package/io-ts/dist/io-ts.umd.js +1 -1
  82. package/io-ts/dist/io-ts.umd.js.map +1 -1
  83. package/package.json +47 -36
  84. package/standard-schema/dist/index.d.ts +2 -0
  85. package/standard-schema/dist/standard-schema.d.ts +2 -0
  86. package/standard-schema/dist/standard-schema.js +2 -0
  87. package/standard-schema/dist/standard-schema.js.map +1 -0
  88. package/standard-schema/dist/standard-schema.mjs +2 -0
  89. package/standard-schema/dist/standard-schema.modern.mjs +2 -0
  90. package/standard-schema/dist/standard-schema.modern.mjs.map +1 -0
  91. package/standard-schema/dist/standard-schema.module.js +2 -0
  92. package/standard-schema/dist/standard-schema.module.js.map +1 -0
  93. package/standard-schema/dist/standard-schema.umd.js +2 -0
  94. package/standard-schema/dist/standard-schema.umd.js.map +1 -0
  95. package/standard-schema/dist/types.d.ts +3 -0
  96. package/standard-schema/package.json +18 -0
  97. package/standard-schema/src/__tests__/Form-native-validation.tsx +82 -0
  98. package/standard-schema/src/__tests__/Form.tsx +56 -0
  99. package/standard-schema/src/__tests__/__fixtures__/data.ts +65 -0
  100. package/standard-schema/src/__tests__/__snapshots__/standard-schema.ts.snap +63 -0
  101. package/standard-schema/src/__tests__/standard-schema.ts +28 -0
  102. package/standard-schema/src/index.ts +2 -0
  103. package/standard-schema/src/standard-schema.ts +45 -0
  104. package/standard-schema/src/types.ts +10 -0
  105. package/superstruct/dist/superstruct.js +1 -1
  106. package/superstruct/dist/superstruct.js.map +1 -1
  107. package/superstruct/dist/superstruct.mjs +1 -1
  108. package/superstruct/dist/superstruct.modern.mjs +1 -1
  109. package/superstruct/dist/superstruct.modern.mjs.map +1 -1
  110. package/superstruct/dist/superstruct.module.js +1 -1
  111. package/superstruct/dist/superstruct.module.js.map +1 -1
  112. package/superstruct/dist/superstruct.umd.js +1 -1
  113. package/superstruct/dist/superstruct.umd.js.map +1 -1
  114. package/superstruct/src/superstruct.ts +1 -1
  115. package/typebox/src/__tests__/__snapshots__/typebox-compiler.ts.snap +21 -21
  116. package/typebox/src/__tests__/__snapshots__/typebox.ts.snap +21 -21
  117. package/typeschema/dist/typeschema.js +1 -1
  118. package/typeschema/dist/typeschema.js.map +1 -1
  119. package/typeschema/dist/typeschema.mjs +1 -1
  120. package/typeschema/dist/typeschema.modern.mjs +1 -1
  121. package/typeschema/dist/typeschema.modern.mjs.map +1 -1
  122. package/typeschema/dist/typeschema.module.js +1 -1
  123. package/typeschema/dist/typeschema.module.js.map +1 -1
  124. package/typeschema/dist/typeschema.umd.js +1 -1
  125. package/typeschema/dist/typeschema.umd.js.map +1 -1
  126. package/typeschema/src/typeschema.ts +3 -1
  127. package/valibot/dist/valibot.js +1 -1
  128. package/valibot/dist/valibot.js.map +1 -1
  129. package/valibot/dist/valibot.mjs +1 -1
  130. package/valibot/dist/valibot.modern.mjs +1 -1
  131. package/valibot/dist/valibot.modern.mjs.map +1 -1
  132. package/valibot/dist/valibot.module.js +1 -1
  133. package/valibot/dist/valibot.module.js.map +1 -1
  134. package/valibot/dist/valibot.umd.js +1 -1
  135. package/valibot/dist/valibot.umd.js.map +1 -1
  136. package/valibot/package.json +1 -1
  137. package/valibot/src/__tests__/valibot.ts +1 -1
  138. package/valibot/src/valibot.ts +3 -1
  139. package/vine/dist/vine.js +1 -1
  140. package/vine/dist/vine.js.map +1 -1
  141. package/vine/dist/vine.mjs +1 -1
  142. package/vine/dist/vine.modern.mjs +1 -1
  143. package/vine/dist/vine.modern.mjs.map +1 -1
  144. package/vine/dist/vine.module.js +1 -1
  145. package/vine/dist/vine.module.js.map +1 -1
  146. package/vine/dist/vine.umd.js +1 -1
  147. package/vine/dist/vine.umd.js.map +1 -1
  148. package/vine/src/vine.ts +1 -1
  149. package/yup/dist/yup.js +1 -1
  150. package/yup/dist/yup.js.map +1 -1
  151. package/yup/dist/yup.mjs +1 -1
  152. package/yup/dist/yup.modern.mjs +1 -1
  153. package/yup/dist/yup.modern.mjs.map +1 -1
  154. package/yup/dist/yup.module.js +1 -1
  155. package/yup/dist/yup.module.js.map +1 -1
  156. package/yup/dist/yup.umd.js +1 -1
  157. package/yup/dist/yup.umd.js.map +1 -1
  158. package/yup/src/yup.ts +1 -1
  159. package/zod/dist/zod.js +1 -1
  160. package/zod/dist/zod.js.map +1 -1
  161. package/zod/dist/zod.mjs +1 -1
  162. package/zod/dist/zod.modern.mjs +1 -1
  163. package/zod/dist/zod.modern.mjs.map +1 -1
  164. package/zod/dist/zod.module.js +1 -1
  165. package/zod/dist/zod.module.js.map +1 -1
  166. package/zod/dist/zod.umd.js +1 -1
  167. package/zod/dist/zod.umd.js.map +1 -1
  168. package/zod/src/zod.ts +1 -1
@@ -0,0 +1,82 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import user from '@testing-library/user-event';
3
+ import { type } from 'arktype';
4
+ import React from 'react';
5
+ import { useForm } from 'react-hook-form';
6
+ import { standardSchemaResolver } from '..';
7
+
8
+ const schema = type({
9
+ username: 'string>1',
10
+ password: 'string>1',
11
+ });
12
+
13
+ type FormData = typeof schema.infer;
14
+
15
+ interface Props {
16
+ onSubmit: (data: FormData) => void;
17
+ }
18
+
19
+ function TestComponent({ onSubmit }: Props) {
20
+ const { register, handleSubmit } = useForm<FormData>({
21
+ resolver: standardSchemaResolver(schema),
22
+ shouldUseNativeValidation: true,
23
+ });
24
+
25
+ return (
26
+ <form onSubmit={handleSubmit(onSubmit)}>
27
+ <input {...register('username')} placeholder="username" />
28
+
29
+ <input {...register('password')} placeholder="password" />
30
+
31
+ <button type="submit">submit</button>
32
+ </form>
33
+ );
34
+ }
35
+
36
+ test("form's native validation with arkType", async () => {
37
+ const handleSubmit = vi.fn();
38
+ render(<TestComponent onSubmit={handleSubmit} />);
39
+
40
+ // username
41
+ let usernameField = screen.getByPlaceholderText(
42
+ /username/i,
43
+ ) as HTMLInputElement;
44
+ expect(usernameField.validity.valid).toBe(true);
45
+ expect(usernameField.validationMessage).toBe('');
46
+
47
+ // password
48
+ let passwordField = screen.getByPlaceholderText(
49
+ /password/i,
50
+ ) as HTMLInputElement;
51
+ expect(passwordField.validity.valid).toBe(true);
52
+ expect(passwordField.validationMessage).toBe('');
53
+
54
+ await user.click(screen.getByText(/submit/i));
55
+
56
+ // username
57
+ usernameField = screen.getByPlaceholderText(/username/i) as HTMLInputElement;
58
+ expect(usernameField.validity.valid).toBe(false);
59
+ expect(usernameField.validationMessage).toBe(
60
+ 'username must be at least length 2',
61
+ );
62
+
63
+ // password
64
+ passwordField = screen.getByPlaceholderText(/password/i) as HTMLInputElement;
65
+ expect(passwordField.validity.valid).toBe(false);
66
+ expect(passwordField.validationMessage).toBe(
67
+ 'password must be at least length 2',
68
+ );
69
+
70
+ await user.type(screen.getByPlaceholderText(/username/i), 'joe');
71
+ await user.type(screen.getByPlaceholderText(/password/i), 'password');
72
+
73
+ // username
74
+ usernameField = screen.getByPlaceholderText(/username/i) as HTMLInputElement;
75
+ expect(usernameField.validity.valid).toBe(true);
76
+ expect(usernameField.validationMessage).toBe('');
77
+
78
+ // password
79
+ passwordField = screen.getByPlaceholderText(/password/i) as HTMLInputElement;
80
+ expect(passwordField.validity.valid).toBe(true);
81
+ expect(passwordField.validationMessage).toBe('');
82
+ });
@@ -0,0 +1,56 @@
1
+ import { render, screen } from '@testing-library/react';
2
+ import user from '@testing-library/user-event';
3
+ import { type } from 'arktype';
4
+ import React from 'react';
5
+ import { useForm } from 'react-hook-form';
6
+ import { standardSchemaResolver } from '..';
7
+
8
+ const schema = type({
9
+ username: 'string>1',
10
+ password: 'string>1',
11
+ });
12
+
13
+ type FormData = typeof schema.infer & { unusedProperty: string };
14
+
15
+ interface Props {
16
+ onSubmit: (data: FormData) => void;
17
+ }
18
+
19
+ function TestComponent({ onSubmit }: Props) {
20
+ const {
21
+ register,
22
+ handleSubmit,
23
+ formState: { errors },
24
+ } = useForm<FormData>({
25
+ resolver: standardSchemaResolver(schema), // Useful to check TypeScript regressions
26
+ });
27
+
28
+ return (
29
+ <form onSubmit={handleSubmit(onSubmit)}>
30
+ <input {...register('username')} />
31
+ {errors.username && <span role="alert">{errors.username.message}</span>}
32
+
33
+ <input {...register('password')} />
34
+ {errors.password && <span role="alert">{errors.password.message}</span>}
35
+
36
+ <button type="submit">submit</button>
37
+ </form>
38
+ );
39
+ }
40
+
41
+ test("form's validation with arkType and TypeScript's integration", async () => {
42
+ const handleSubmit = vi.fn();
43
+ render(<TestComponent onSubmit={handleSubmit} />);
44
+
45
+ expect(screen.queryAllByRole('alert')).toHaveLength(0);
46
+
47
+ await user.click(screen.getByText(/submit/i));
48
+
49
+ expect(
50
+ screen.getByText('username must be at least length 2'),
51
+ ).toBeInTheDocument();
52
+ expect(
53
+ screen.getByText('password must be at least length 2'),
54
+ ).toBeInTheDocument();
55
+ expect(handleSubmit).not.toHaveBeenCalled();
56
+ });
@@ -0,0 +1,65 @@
1
+ import { type } from 'arktype';
2
+ import { Field, InternalFieldName } from 'react-hook-form';
3
+
4
+ export const schema = type({
5
+ username: 'string>2',
6
+ password: '/.*[A-Za-z].*/>8|/.*\\d.*/',
7
+ repeatPassword: 'string>1',
8
+ accessToken: 'string|number',
9
+ birthYear: '1900<number<2013',
10
+ email: 'string.email',
11
+ tags: 'string[]',
12
+ enabled: 'boolean',
13
+ url: 'string>1',
14
+ 'like?': type({
15
+ id: 'number',
16
+ name: 'string>3',
17
+ }).array(),
18
+ dateStr: 'Date',
19
+ });
20
+
21
+ export const validData: typeof schema.infer = {
22
+ username: 'Doe',
23
+ password: 'Password123_',
24
+ repeatPassword: 'Password123_',
25
+ birthYear: 2000,
26
+ email: 'john@doe.com',
27
+ tags: ['tag1', 'tag2'],
28
+ enabled: true,
29
+ accessToken: 'accessToken',
30
+ url: 'https://react-hook-form.com/',
31
+ like: [
32
+ {
33
+ id: 1,
34
+ name: 'name',
35
+ },
36
+ ],
37
+ dateStr: new Date('2020-01-01'),
38
+ };
39
+
40
+ export const invalidData = {
41
+ password: '___',
42
+ email: '',
43
+ birthYear: 'birthYear',
44
+ like: [{ id: 'z' }],
45
+ url: 'abc',
46
+ };
47
+
48
+ export const fields: Record<InternalFieldName, Field['_f']> = {
49
+ username: {
50
+ ref: { name: 'username' },
51
+ name: 'username',
52
+ },
53
+ password: {
54
+ ref: { name: 'password' },
55
+ name: 'password',
56
+ },
57
+ email: {
58
+ ref: { name: 'email' },
59
+ name: 'email',
60
+ },
61
+ birthday: {
62
+ ref: { name: 'birthday' },
63
+ name: 'birthday',
64
+ },
65
+ };
@@ -0,0 +1,63 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`standardSchemaResolver > should return a single error from standardSchemaResolver when validation fails 1`] = `
4
+ {
5
+ "errors": {
6
+ "accessToken": {
7
+ "message": "accessToken must be a number or a string (was missing)",
8
+ "ref": undefined,
9
+ },
10
+ "birthYear": {
11
+ "message": "birthYear must be a number (was a string)",
12
+ "ref": undefined,
13
+ },
14
+ "dateStr": {
15
+ "message": "dateStr must be a Date (was missing)",
16
+ "ref": undefined,
17
+ },
18
+ "email": {
19
+ "message": "email must be an email address (was "")",
20
+ "ref": {
21
+ "name": "email",
22
+ },
23
+ },
24
+ "enabled": {
25
+ "message": "enabled must be boolean (was missing)",
26
+ "ref": undefined,
27
+ },
28
+ "like": [
29
+ {
30
+ "id": {
31
+ "message": "like[0].id must be a number (was a string)",
32
+ "ref": undefined,
33
+ },
34
+ "name": {
35
+ "message": "like[0].name must be a string (was missing)",
36
+ "ref": undefined,
37
+ },
38
+ },
39
+ ],
40
+ "password": {
41
+ "message": "password must be matched by .*[A-Za-z].* or matched by .*\\d.* (was "___")",
42
+ "ref": {
43
+ "name": "password",
44
+ },
45
+ },
46
+ "repeatPassword": {
47
+ "message": "repeatPassword must be a string (was missing)",
48
+ "ref": undefined,
49
+ },
50
+ "tags": {
51
+ "message": "tags must be an array (was missing)",
52
+ "ref": undefined,
53
+ },
54
+ "username": {
55
+ "message": "username must be a string (was missing)",
56
+ "ref": {
57
+ "name": "username",
58
+ },
59
+ },
60
+ },
61
+ "values": {},
62
+ }
63
+ `;
@@ -0,0 +1,28 @@
1
+ import { standardSchemaResolver } from '..';
2
+ import { fields, invalidData, schema, validData } from './__fixtures__/data';
3
+
4
+ const shouldUseNativeValidation = false;
5
+
6
+ describe('standardSchemaResolver', () => {
7
+ it('should return values from standardSchemaResolver when validation pass & raw=true', async () => {
8
+ const result = await standardSchemaResolver(schema)(validData, undefined, {
9
+ fields,
10
+ shouldUseNativeValidation,
11
+ });
12
+
13
+ expect(result).toEqual({ errors: {}, values: validData });
14
+ });
15
+
16
+ it('should return a single error from standardSchemaResolver when validation fails', async () => {
17
+ const result = await standardSchemaResolver(schema)(
18
+ invalidData,
19
+ undefined,
20
+ {
21
+ fields,
22
+ shouldUseNativeValidation,
23
+ },
24
+ );
25
+
26
+ expect(result).toMatchSnapshot();
27
+ });
28
+ });
@@ -0,0 +1,2 @@
1
+ export * from './standard-schema';
2
+ export * from './types';
@@ -0,0 +1,45 @@
1
+ import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';
2
+ import { StandardSchemaV1 } from '@standard-schema/spec';
3
+ import { FieldError } from 'react-hook-form';
4
+ import type { Resolver } from './types';
5
+
6
+ const parseIssues = (issues: readonly StandardSchemaV1.Issue[]) => {
7
+ const errors: Record<string, FieldError> = {};
8
+
9
+ for (let i = 0; i < issues.length; i++) {
10
+ const issue = issues[i];
11
+ const path = issue.path?.join('.') ?? '';
12
+
13
+ if (path) {
14
+ if (!errors[path]) {
15
+ errors[path] = { message: issue.message } as FieldError;
16
+ }
17
+ }
18
+ }
19
+
20
+ return errors;
21
+ };
22
+
23
+ export const standardSchemaResolver: Resolver =
24
+ (schema) => async (values, _, options) => {
25
+ let result = schema['~standard'].validate(values);
26
+ if (result instanceof Promise) {
27
+ result = await result;
28
+ }
29
+
30
+ if (result.issues) {
31
+ const errors = parseIssues(result.issues);
32
+
33
+ return {
34
+ values: {},
35
+ errors: toNestErrors(errors, options),
36
+ };
37
+ }
38
+
39
+ options.shouldUseNativeValidation && validateFieldsNatively({}, options);
40
+
41
+ return {
42
+ values: values,
43
+ errors: {},
44
+ };
45
+ };
@@ -0,0 +1,10 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { FieldValues, ResolverOptions, ResolverResult } from 'react-hook-form';
3
+
4
+ export type Resolver = <T extends StandardSchemaV1<any, any>>(
5
+ schema: T,
6
+ ) => <TFieldValues extends FieldValues, TContext>(
7
+ values: TFieldValues,
8
+ context: TContext | undefined,
9
+ options: ResolverOptions<TFieldValues>,
10
+ ) => Promise<ResolverResult<TFieldValues>>;
@@ -1,2 +1,2 @@
1
- var e=require("@hookform/resolvers"),r=require("superstruct");exports.superstructResolver=function(s,t,a){return void 0===a&&(a={}),function(o,u,i){var l,n=r.validate(o,s,t);return n[0]?{values:{},errors:e.toNestErrors((l=n[0],l.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),i)}:(i.shouldUseNativeValidation&&e.validateFieldsNatively({},i),{values:a.raw?o:n[1],errors:{}})}};
1
+ var e=require("@hookform/resolvers"),r=require("superstruct");exports.superstructResolver=function(s,t,a){return void 0===a&&(a={}),function(o,u,i){var n,l=r.validate(o,s,t);return l[0]?{values:{},errors:e.toNestErrors((n=l[0],n.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),i)}:(i.shouldUseNativeValidation&&e.validateFieldsNatively({},i),{values:a.raw?Object.assign({},o):l[1],errors:{}})}};
2
2
  //# sourceMappingURL=superstruct.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"superstruct.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? values : result[1],\n errors: {},\n };\n };\n"],"names":["schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw"],"mappings":"0FAiBE,SAACA,EAAQC,EAAeC,GACxB,YADwBA,IAAAA,IAAAA,EAAkB,CAAA,GAC1C,SAACC,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAAQA,SAACL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,CAAE,EACVM,OAAQC,EAAAA,cAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GACT,OAACO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,CAAA,IAWsDR,KAItDA,EAAQa,2BAA6BC,EAAAA,uBAAuB,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMjB,EAASI,EAAO,GAC9CE,OAAQ,CAAA,GAEZ,CAAC"}
1
+ {"version":3,"file":"superstruct.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? Object.assign({}, values) : result[1],\n errors: {},\n };\n };\n"],"names":["schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw","Object","assign"],"mappings":"0FAiBE,SAACA,EAAQC,EAAeC,GAAoB,gBAApBA,IAAAA,EAAkB,CAAE,GAC3CC,SAAAA,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAAAA,SAASL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,EAAAA,cAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GAAK,OACbO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,KAWsDR,KAItDA,EAAQa,2BAA6BC,EAAsBA,uBAAC,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMC,OAAOC,OAAO,CAAE,EAAEnB,GAAUI,EAAO,GACjEE,OAAQ,CAAA,GAEZ,CAAC"}
@@ -1,2 +1,2 @@
1
- import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var t=function(t,s,u){return void 0===u&&(u={}),function(a,i,n){var f,m=o(a,t,s);return m[0]?{values:{},errors:r((f=m[0],f.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:u.raw?a:m[1],errors:{}})}};export{t as superstructResolver};
1
+ import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var s=function(s,t,a){return void 0===a&&(a={}),function(u,i,n){var f,m=o(u,s,t);return m[0]?{values:{},errors:r((f=m[0],f.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:a.raw?Object.assign({},u):m[1],errors:{}})}};export{s as superstructResolver};
2
2
  //# sourceMappingURL=superstruct.module.js.map
@@ -1,2 +1,2 @@
1
- import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as s}from"superstruct";const o=(o,t,a={})=>(u,i,m)=>{const p=s(u,o,t);return p[0]?{values:{},errors:r((l=p[0],l.failures().reduce((r,e)=>(r[e.path.join(".")]={message:e.message,type:e.type})&&r,{})),m)}:(m.shouldUseNativeValidation&&e({},m),{values:a.raw?u:p[1],errors:{}});var l};export{o as superstructResolver};
1
+ import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as s}from"superstruct";const o=(o,t,a={})=>(i,u,m)=>{const p=s(i,o,t);return p[0]?{values:{},errors:r((l=p[0],l.failures().reduce((r,e)=>(r[e.path.join(".")]={message:e.message,type:e.type})&&r,{})),m)}:(m.shouldUseNativeValidation&&e({},m),{values:a.raw?Object.assign({},i):p[1],errors:{}});var l};export{o as superstructResolver};
2
2
  //# sourceMappingURL=superstruct.modern.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"superstruct.modern.mjs","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? values : result[1],\n errors: {},\n };\n };\n"],"names":["superstructResolver","schema","schemaOptions","resolverOptions","values","_","options","result","validate","errors","toNestErrors","error","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw"],"mappings":"sHAMA,MAUaA,EACXA,CAACC,EAAQC,EAAeC,EAAkB,CAAE,IAC5C,CAACC,EAAQC,EAAGC,KACV,MAAMC,EAASC,EAASJ,EAAQH,EAAQC,GAExC,OAAIK,EAAO,GACF,CACLH,OAAQ,CAAA,EACRK,OAAQC,GAlBUC,EAkBoBJ,EAAO,GAjBnDI,EAAMC,WAAWC,OACf,CAACC,EAAUH,KACRG,EAASH,EAAMI,KAAKC,KAAK,MAAQ,CAChCC,QAASN,EAAMM,QACfC,KAAMP,EAAMO,QACRJ,EACR,CAAA,IAWsDR,KAItDA,EAAQa,2BAA6BC,EAAuB,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMjB,EAASG,EAAO,GAC9CE,OAAQ,KA1BYE"}
1
+ {"version":3,"file":"superstruct.modern.mjs","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? Object.assign({}, values) : result[1],\n errors: {},\n };\n };\n"],"names":["superstructResolver","schema","schemaOptions","resolverOptions","values","_","options","result","validate","errors","toNestErrors","error","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw","Object","assign"],"mappings":"sHAMA,MAUaA,EACXA,CAACC,EAAQC,EAAeC,EAAkB,CAAA,IAC1C,CAACC,EAAQC,EAAGC,KACV,MAAMC,EAASC,EAASJ,EAAQH,EAAQC,GAExC,OAAIK,EAAO,GACF,CACLH,OAAQ,CAAA,EACRK,OAAQC,GAlBUC,EAkBoBJ,EAAO,GAjBnDI,EAAMC,WAAWC,OACf,CAACC,EAAUH,KACRG,EAASH,EAAMI,KAAKC,KAAK,MAAQ,CAChCC,QAASN,EAAMM,QACfC,KAAMP,EAAMO,QACRJ,EACR,CAAA,IAWsDR,KAItDA,EAAQa,2BAA6BC,EAAuB,GAAId,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMC,OAAOC,OAAO,CAAE,EAAEnB,GAAUG,EAAO,GACjEE,OAAQ,KA1BYE"}
@@ -1,2 +1,2 @@
1
- import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var t=function(t,s,u){return void 0===u&&(u={}),function(a,i,n){var f,m=o(a,t,s);return m[0]?{values:{},errors:r((f=m[0],f.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:u.raw?a:m[1],errors:{}})}};export{t as superstructResolver};
1
+ import{toNestErrors as r,validateFieldsNatively as e}from"@hookform/resolvers";import{validate as o}from"superstruct";var s=function(s,t,a){return void 0===a&&(a={}),function(u,i,n){var f,m=o(u,s,t);return m[0]?{values:{},errors:r((f=m[0],f.failures().reduce(function(r,e){return(r[e.path.join(".")]={message:e.message,type:e.type})&&r},{})),n)}:(n.shouldUseNativeValidation&&e({},n),{values:a.raw?Object.assign({},u):m[1],errors:{}})}};export{s as superstructResolver};
2
2
  //# sourceMappingURL=superstruct.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"superstruct.module.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? values : result[1],\n errors: {},\n };\n };\n"],"names":["superstructResolver","schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw"],"mappings":"sHAMA,IAUaA,EACX,SAACC,EAAQC,EAAeC,GACxB,YADwBA,IAAAA,IAAAA,EAAkB,CAAA,GAC1C,SAACC,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAASL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,CAAE,EACVM,OAAQC,GAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GACT,OAACO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,CAAA,IAWsDR,KAItDA,EAAQa,2BAA6BC,EAAuB,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMjB,EAASI,EAAO,GAC9CE,OAAQ,CAAA,GAEZ,CAAC"}
1
+ {"version":3,"file":"superstruct.module.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? Object.assign({}, values) : result[1],\n errors: {},\n };\n };\n"],"names":["superstructResolver","schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw","Object","assign"],"mappings":"sHAMA,IAUaA,EACX,SAACC,EAAQC,EAAeC,GAAoB,gBAApBA,IAAAA,EAAkB,CAAE,GAC3CC,SAAAA,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAASL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,GAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GAAK,OACbO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,KAWsDR,KAItDA,EAAQa,2BAA6BC,EAAuB,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMC,OAAOC,OAAO,CAAE,EAAEnB,GAAUI,EAAO,GACjEE,OAAQ,CAAA,GAEZ,CAAC"}
@@ -1,2 +1,2 @@
1
- !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@hookform/resolvers"),require("superstruct")):"function"==typeof define&&define.amd?define(["exports","@hookform/resolvers","superstruct"],r):r((e||self).hookformResolversSuperstruct={},e.hookformResolvers,e.superstruct)}(this,function(e,r,o){e.superstructResolver=function(e,s,t){return void 0===t&&(t={}),function(u,i,n){var f,l=o.validate(u,e,s);return l[0]?{values:{},errors:r.toNestErrors((f=l[0],f.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),n)}:(n.shouldUseNativeValidation&&r.validateFieldsNatively({},n),{values:t.raw?u:l[1],errors:{}})}}});
1
+ !function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@hookform/resolvers"),require("superstruct")):"function"==typeof define&&define.amd?define(["exports","@hookform/resolvers","superstruct"],r):r((e||self).hookformResolversSuperstruct={},e.hookformResolvers,e.superstruct)}(this,function(e,r,o){e.superstructResolver=function(e,s,t){return void 0===t&&(t={}),function(u,i,n){var f,a=o.validate(u,e,s);return a[0]?{values:{},errors:r.toNestErrors((f=a[0],f.failures().reduce(function(e,r){return(e[r.path.join(".")]={message:r.message,type:r.type})&&e},{})),n)}:(n.shouldUseNativeValidation&&r.validateFieldsNatively({},n),{values:t.raw?Object.assign({},u):a[1],errors:{}})}}});
2
2
  //# sourceMappingURL=superstruct.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"superstruct.umd.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? values : result[1],\n errors: {},\n };\n };\n"],"names":["schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw"],"mappings":"4YAiBE,SAACA,EAAQC,EAAeC,GACxB,YADwBA,IAAAA,IAAAA,EAAkB,CAAA,GAC1C,SAACC,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAAQA,SAACL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,CAAE,EACVM,OAAQC,EAAAA,cAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GACT,OAACO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,CAAA,IAWsDR,KAItDA,EAAQa,2BAA6BC,EAAAA,uBAAuB,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMjB,EAASI,EAAO,GAC9CE,OAAQ,CAAA,GAEZ,CAAC"}
1
+ {"version":3,"file":"superstruct.umd.js","sources":["../src/superstruct.ts"],"sourcesContent":["import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';\nimport { FieldError } from 'react-hook-form';\n\nimport { StructError, validate } from 'superstruct';\nimport { Resolver } from './types';\n\nconst parseErrorSchema = (error: StructError) =>\n error.failures().reduce<Record<string, FieldError>>(\n (previous, error) =>\n (previous[error.path.join('.')] = {\n message: error.message,\n type: error.type,\n }) && previous,\n {},\n );\n\nexport const superstructResolver: Resolver =\n (schema, schemaOptions, resolverOptions = {}) =>\n (values, _, options) => {\n const result = validate(values, schema, schemaOptions);\n\n if (result[0]) {\n return {\n values: {},\n errors: toNestErrors(parseErrorSchema(result[0]), options),\n };\n }\n\n options.shouldUseNativeValidation && validateFieldsNatively({}, options);\n\n return {\n values: resolverOptions.raw ? Object.assign({}, values) : result[1],\n errors: {},\n };\n };\n"],"names":["schema","schemaOptions","resolverOptions","values","_","options","error","result","validate","errors","toNestErrors","failures","reduce","previous","path","join","message","type","shouldUseNativeValidation","validateFieldsNatively","raw","Object","assign"],"mappings":"4YAiBE,SAACA,EAAQC,EAAeC,GAAoB,gBAApBA,IAAAA,EAAkB,CAAE,GAC3CC,SAAAA,EAAQC,EAAGC,GACV,IAbsBC,EAahBC,EAASC,EAAAA,SAASL,EAAQH,EAAQC,GAExC,OAAIM,EAAO,GACF,CACLJ,OAAQ,GACRM,OAAQC,EAAAA,cAlBUJ,EAkBoBC,EAAO,GAjBnDD,EAAMK,WAAWC,OACf,SAACC,EAAUP,GAAK,OACbO,EAASP,EAAMQ,KAAKC,KAAK,MAAQ,CAChCC,QAASV,EAAMU,QACfC,KAAMX,EAAMW,QACRJ,CAAQ,EAChB,KAWsDR,KAItDA,EAAQa,2BAA6BC,EAAsBA,uBAAC,CAAE,EAAEd,GAEzD,CACLF,OAAQD,EAAgBkB,IAAMC,OAAOC,OAAO,CAAE,EAAEnB,GAAUI,EAAO,GACjEE,OAAQ,CAAA,GAEZ,CAAC"}
@@ -29,7 +29,7 @@ export const superstructResolver: Resolver =
29
29
  options.shouldUseNativeValidation && validateFieldsNatively({}, options);
30
30
 
31
31
  return {
32
- values: resolverOptions.raw ? values : result[1],
32
+ values: resolverOptions.raw ? Object.assign({}, values) : result[1],
33
33
  errors: {},
34
34
  };
35
35
  };
@@ -4,7 +4,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
4
4
  {
5
5
  "errors": {
6
6
  "accessToken": {
7
- "message": "Required property",
7
+ "message": "Expected required property",
8
8
  "ref": undefined,
9
9
  "type": "45",
10
10
  },
@@ -14,7 +14,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
14
14
  "type": "41",
15
15
  },
16
16
  "dateStr": {
17
- "message": "Required property",
17
+ "message": "Expected required property",
18
18
  "ref": undefined,
19
19
  "type": "45",
20
20
  },
@@ -26,7 +26,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
26
26
  "type": "48",
27
27
  },
28
28
  "enabled": {
29
- "message": "Required property",
29
+ "message": "Expected required property",
30
30
  "ref": undefined,
31
31
  "type": "45",
32
32
  },
@@ -38,7 +38,7 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
38
38
  "type": "41",
39
39
  },
40
40
  "name": {
41
- "message": "Required property",
41
+ "message": "Expected required property",
42
42
  "ref": undefined,
43
43
  "type": "45",
44
44
  },
@@ -52,17 +52,17 @@ exports[`typeboxResolver (with compiler) > should return a single error from typ
52
52
  "type": "52",
53
53
  },
54
54
  "repeatPassword": {
55
- "message": "Required property",
55
+ "message": "Expected required property",
56
56
  "ref": undefined,
57
57
  "type": "45",
58
58
  },
59
59
  "tags": {
60
- "message": "Required property",
60
+ "message": "Expected required property",
61
61
  "ref": undefined,
62
62
  "type": "45",
63
63
  },
64
64
  "username": {
65
- "message": "Required property",
65
+ "message": "Expected required property",
66
66
  "ref": {
67
67
  "name": "username",
68
68
  },
@@ -77,11 +77,11 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
77
77
  {
78
78
  "errors": {
79
79
  "accessToken": {
80
- "message": "Required property",
80
+ "message": "Expected required property",
81
81
  "ref": undefined,
82
82
  "type": "45",
83
83
  "types": {
84
- "45": "Required property",
84
+ "45": "Expected required property",
85
85
  "62": "Expected union value",
86
86
  },
87
87
  },
@@ -94,12 +94,12 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
94
94
  },
95
95
  },
96
96
  "dateStr": {
97
- "message": "Required property",
97
+ "message": "Expected required property",
98
98
  "ref": undefined,
99
99
  "type": "45",
100
100
  "types": {
101
101
  "20": "Expected Date",
102
- "45": "Required property",
102
+ "45": "Expected required property",
103
103
  },
104
104
  },
105
105
  "email": {
@@ -113,12 +113,12 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
113
113
  },
114
114
  },
115
115
  "enabled": {
116
- "message": "Required property",
116
+ "message": "Expected required property",
117
117
  "ref": undefined,
118
118
  "type": "45",
119
119
  "types": {
120
120
  "14": "Expected boolean",
121
- "45": "Required property",
121
+ "45": "Expected required property",
122
122
  },
123
123
  },
124
124
  "like": [
@@ -132,11 +132,11 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
132
132
  },
133
133
  },
134
134
  "name": {
135
- "message": "Required property",
135
+ "message": "Expected required property",
136
136
  "ref": undefined,
137
137
  "type": "45",
138
138
  "types": {
139
- "45": "Required property",
139
+ "45": "Expected required property",
140
140
  "54": "Expected string",
141
141
  },
142
142
  },
@@ -154,31 +154,31 @@ exports[`typeboxResolver (with compiler) > should return all the errors from typ
154
154
  },
155
155
  },
156
156
  "repeatPassword": {
157
- "message": "Required property",
157
+ "message": "Expected required property",
158
158
  "ref": undefined,
159
159
  "type": "45",
160
160
  "types": {
161
- "45": "Required property",
161
+ "45": "Expected required property",
162
162
  "54": "Expected string",
163
163
  },
164
164
  },
165
165
  "tags": {
166
- "message": "Required property",
166
+ "message": "Expected required property",
167
167
  "ref": undefined,
168
168
  "type": "45",
169
169
  "types": {
170
- "45": "Required property",
170
+ "45": "Expected required property",
171
171
  "6": "Expected array",
172
172
  },
173
173
  },
174
174
  "username": {
175
- "message": "Required property",
175
+ "message": "Expected required property",
176
176
  "ref": {
177
177
  "name": "username",
178
178
  },
179
179
  "type": "45",
180
180
  "types": {
181
- "45": "Required property",
181
+ "45": "Expected required property",
182
182
  "54": "Expected string",
183
183
  },
184
184
  },