You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Admin/ajv.ts
+33-10Lines changed: 33 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
import{__,sprintf}from'@wordpress/i18n';
2
2
import{JSONSchemaType}from'ajv';
3
-
importaddFormatsfrom'ajv-formats';
4
3
importaddErrorsfrom'ajv-errors';
4
+
importaddFormatsfrom'ajv-formats';
5
5
6
6
/**
7
7
* Create an AJV resolver for react-hook-form with WordPress REST API schema
@@ -15,6 +15,7 @@ import addErrors from 'ajv-errors';
15
15
* Key advantage: WordPress REST API supports most JSON Schema Draft 4 features but lacks
16
16
* some advanced features (if/then/else, allOf, not) that AJV can provide for enhanced frontend validation.
17
17
*
18
+
* @since 4.10.0 Refactor transformWordPressSchemaToDraft7 to handle readonly/readOnly fields and conditionally remove enum from nullable fields when value is null to prevent AJV conflicts
18
19
* @since 4.9.0
19
20
*
20
21
* @param schema - The JSON Schema from WordPress REST API
@@ -30,7 +31,7 @@ export function ajvResolver(schema: JSONSchemaType<any>) {
0 commit comments