-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema.json
More file actions
707 lines (707 loc) · 21.5 KB
/
Copy pathschema.json
File metadata and controls
707 lines (707 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Cassette-CMF Configuration Schema",
"description": "JSON schema for Cassette-CMF custom post types, settings pages, and field definitions",
"type": "object",
"properties": {
"cpts": {
"type": "array",
"description": "Array of custom post type definitions",
"items": {
"$ref": "#/definitions/customPostType"
}
},
"settings_pages": {
"type": "array",
"description": "Array of settings page definitions",
"items": {
"$ref": "#/definitions/settingsPage"
}
}
},
"additionalProperties": false,
"definitions": {
"customPostType": {
"type": "object",
"required": ["id"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Post type identifier (max 20 characters, lowercase, underscores)",
"pattern": "^[a-z_]{1,20}$",
"minLength": 1,
"maxLength": 20,
"examples": ["book", "product", "event", "portfolio"]
},
"args": {
"type": "object",
"description": "WordPress register_post_type() arguments",
"additionalProperties": true,
"properties": {
"label": {
"type": "string",
"description": "Plural name for the post type",
"minLength": 1
},
"labels": {
"$ref": "#/definitions/postTypeLabels"
},
"description": {
"type": "string",
"description": "Short descriptive summary",
"maxLength": 255
},
"public": {
"type": "boolean",
"description": "Whether the post type is public",
"default": true
},
"hierarchical": {
"type": "boolean",
"description": "Whether the post type is hierarchical (like pages)",
"default": false
},
"supports": {
"type": "array",
"description": "Features this post type supports",
"uniqueItems": true,
"items": {
"type": "string",
"enum": ["title", "editor", "author", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "page-attributes", "post-formats"]
}
},
"menu_icon": {
"type": "string",
"description": "Dashicon class (dashicons-*) or URL for menu icon",
"examples": ["dashicons-book", "dashicons-cart", "dashicons-admin-home"]
},
"menu_position": {
"type": "integer",
"description": "Position in admin menu (5-100)",
"minimum": 5,
"maximum": 100
},
"show_in_rest": {
"type": "boolean",
"description": "Enable REST API and Gutenberg editor support",
"default": false
},
"rest_base": {
"type": "string",
"description": "Custom REST API base path",
"pattern": "^[a-z0-9_-]+$"
},
"capability_type": {
"oneOf": [
{
"type": "string",
"description": "Capability type (singular)",
"examples": ["post", "page"]
},
{
"type": "array",
"description": "Capability type (singular, plural)",
"items": {
"type": "string"
},
"minItems": 2,
"maxItems": 2
}
]
},
"rewrite": {
"oneOf": [
{
"type": "boolean",
"description": "Enable/disable rewrite"
},
{
"type": "object",
"description": "Rewrite configuration",
"properties": {
"slug": {
"type": "string",
"description": "Custom URL slug",
"pattern": "^[a-z0-9_-]+$"
},
"with_front": {
"type": "boolean",
"description": "Prepend front base to permalink",
"default": true
},
"feeds": {
"type": "boolean",
"description": "Build feed permastruct"
},
"pages": {
"type": "boolean",
"description": "Build page permastruct"
}
},
"additionalProperties": false
}
]
},
"has_archive": {
"oneOf": [
{
"type": "boolean",
"description": "Enable archive page"
},
{
"type": "string",
"description": "Custom archive slug"
}
]
},
"exclude_from_search": {
"type": "boolean",
"description": "Exclude from search results",
"default": false
},
"publicly_queryable": {
"type": "boolean",
"description": "Whether queries can be performed on the front end"
},
"show_ui": {
"type": "boolean",
"description": "Show admin UI",
"default": true
},
"show_in_menu": {
"oneOf": [
{
"type": "boolean",
"description": "Show in admin menu"
},
{
"type": "string",
"description": "Show as submenu under parent page"
}
]
},
"show_in_nav_menus": {
"type": "boolean",
"description": "Make available for selection in navigation menus"
},
"show_in_admin_bar": {
"type": "boolean",
"description": "Show in admin bar"
}
}
},
"fields": {
"type": "array",
"description": "Array of field definitions for this post type",
"items": {
"$ref": "#/definitions/field"
}
}
}
},
"postTypeLabels": {
"type": "object",
"description": "Custom labels for post type",
"additionalProperties": true,
"properties": {
"name": {
"type": "string",
"description": "General name (plural)"
},
"singular_name": {
"type": "string",
"description": "Singular name"
},
"add_new": {
"type": "string",
"description": "Add new label"
},
"add_new_item": {
"type": "string",
"description": "Add new item label"
},
"edit_item": {
"type": "string",
"description": "Edit item label"
},
"new_item": {
"type": "string",
"description": "New item label"
},
"view_item": {
"type": "string",
"description": "View item label"
},
"search_items": {
"type": "string",
"description": "Search items label"
},
"not_found": {
"type": "string",
"description": "Not found message"
},
"not_found_in_trash": {
"type": "string",
"description": "Not found in trash message"
},
"all_items": {
"type": "string",
"description": "All items label"
},
"menu_name": {
"type": "string",
"description": "Menu name"
}
}
},
"settingsPage": {
"type": "object",
"required": ["id"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the settings page",
"pattern": "^[a-z0-9_-]+$",
"minLength": 1,
"maxLength": 100,
"examples": ["my-plugin-settings", "theme-options", "site-config"]
},
"page_title": {
"type": "string",
"description": "Title shown in browser tab",
"minLength": 1,
"maxLength": 100
},
"menu_title": {
"type": "string",
"description": "Text to be used for the menu",
"minLength": 1,
"maxLength": 50
},
"capability": {
"type": "string",
"description": "Capability required to access the page",
"default": "manage_options",
"enum": ["manage_options", "edit_posts", "edit_pages", "edit_published_posts", "publish_posts", "manage_categories", "moderate_comments", "upload_files", "edit_theme_options", "administrator"]
},
"slug": {
"type": "string",
"description": "Menu slug (defaults to id)",
"pattern": "^[a-z0-9_-]+$"
},
"parent": {
"type": "string",
"description": "Parent menu slug for submenu pages",
"enum": ["options-general.php", "themes.php", "plugins.php", "users.php", "tools.php", "settings.php", "edit.php", "upload.php", "index.php", "edit-comments.php"]
},
"icon": {
"type": "string",
"description": "Dashicon class for top-level menu",
"pattern": "^(dashicons-|data:image/svg\\+xml;base64,)",
"examples": ["dashicons-admin-settings", "dashicons-admin-generic"]
},
"position": {
"type": "integer",
"description": "Menu position for top-level menu (1-100)",
"minimum": 1,
"maximum": 100
},
"fields": {
"type": "array",
"description": "Array of field definitions for this settings page",
"items": {
"$ref": "#/definitions/field"
}
}
}
},
"field": {
"type": "object",
"required": ["name", "type"],
"allOf": [
{
"$ref": "#/definitions/baseField"
},
{
"if": {
"properties": {
"type": {
"const": "select"
}
}
},
"then": {
"required": ["options"]
}
},
{
"if": {
"properties": {
"type": {
"enum": ["radio", "checkbox"]
}
}
},
"then": {
"required": ["options"]
}
},
{
"if": {
"properties": {
"type": {
"const": "tabs"
}
}
},
"then": {
"required": ["tabs"]
}
},
{
"if": {
"properties": {
"type": {
"enum": ["metabox", "group", "repeater"]
}
}
},
"then": {
"required": ["fields"]
}
},
{
"if": {
"properties": {
"type": {
"const": "custom_html"
}
}
},
"then": {
"required": ["content"]
}
}
]
},
"baseField": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Field identifier (used as meta key or option name)",
"pattern": "^[a-z_][a-z0-9_]*$",
"minLength": 1,
"maxLength": 64,
"examples": ["site_title", "user_email", "product_price"]
},
"type": {
"type": "string",
"description": "Field type",
"enum": ["text", "textarea", "select", "checkbox", "radio", "number", "email", "url", "date", "password", "color", "wysiwyg", "tabs", "metabox", "group", "repeater", "custom_html", "upload"]
},
"label": {
"type": "string",
"description": "Field label shown to users",
"minLength": 1,
"maxLength": 200
},
"description": {
"type": "string",
"description": "Help text displayed below the field",
"maxLength": 500
},
"default": {
"description": "Default value for the field (type varies by field type)"
},
"required": {
"type": "boolean",
"description": "Whether the field is required",
"default": false
},
"conditional": {
"type": "object",
"description": "Conditional visibility rules for the field",
"properties": {
"relation": {
"type": "string",
"enum": ["AND", "OR"],
"default": "AND"
},
"rules": {
"type": "array",
"description": "Conditional rules that control field visibility",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string",
"description": "Controlling field name"
},
"operator": {
"type": "string",
"enum": ["==", "!=", ">", ">=", "<", "<=", "in", "not_in", "empty", "not_empty"]
},
"value": {
"description": "Comparison value or values"
},
"values": {
"type": "array",
"description": "Comparison values for in/not_in operators"
}
},
"required": ["field"],
"additionalProperties": false
}
}
},
"required": ["rules"],
"additionalProperties": false
},
"placeholder": {
"type": "string",
"description": "Placeholder text for text-based inputs",
"maxLength": 200
},
"min": {
"description": "Minimum value (for number/date fields) or length (for text fields)"
},
"max": {
"description": "Maximum value (for number/date fields) or length (for text fields)"
},
"step": {
"type": ["integer", "number"],
"description": "Step increment for number fields",
"exclusiveMinimum": 0
},
"pattern": {
"type": "string",
"description": "Regular expression pattern for validation (without delimiters)",
"examples": ["[0-9]{5}", "[A-Z]{2}[0-9]{4}"]
},
"options": {
"type": "object",
"description": "Options for select, radio, and checkbox fields (key: value pairs)",
"minProperties": 1,
"additionalProperties": {
"type": "string"
},
"examples": [
{
"option1": "Label 1",
"option2": "Label 2"
}
]
},
"multiple": {
"type": "boolean",
"description": "Allow multiple selections (for select and checkbox)",
"default": false
},
"inline": {
"type": "boolean",
"description": "Display options inline (for radio and checkbox)",
"default": false
},
"rows": {
"type": "integer",
"description": "Number of rows for textarea",
"minimum": 1,
"maximum": 50,
"default": 5
},
"cols": {
"type": "integer",
"description": "Number of columns for textarea",
"minimum": 10,
"maximum": 200,
"default": 50
},
"maxlength": {
"type": "integer",
"description": "Maximum length for text-based fields",
"minimum": 1,
"maximum": 65535
},
"readonly": {
"type": "boolean",
"description": "Make field read-only",
"default": false
},
"disabled": {
"type": "boolean",
"description": "Disable the field",
"default": false
},
"class": {
"type": "string",
"description": "Additional CSS classes (space-separated)",
"pattern": "^[a-zA-Z0-9_-]+(\\s+[a-zA-Z0-9_-]+)*$"
},
"wrapper_class": {
"type": "string",
"description": "CSS classes for field wrapper (space-separated)",
"pattern": "^[a-zA-Z0-9_-]+(\\s+[a-zA-Z0-9_-]+)*$"
},
"context": {
"type": "string",
"description": "Metabox context for CPT fields",
"enum": ["normal", "side", "advanced"],
"default": "normal"
},
"priority": {
"type": "string",
"description": "Metabox priority for CPT fields",
"enum": ["high", "default", "low"],
"default": "default"
},
"sanitize_callback": {
"type": "string",
"description": "Custom sanitization callback function name"
},
"validation": {
"type": "object",
"description": "Validation rules",
"properties": {
"min_length": {
"type": "integer",
"minimum": 0
},
"max_length": {
"type": "integer",
"minimum": 1
},
"regex": {
"type": "string"
},
"custom_callback": {
"type": "string"
}
}
},
"tabs": {
"type": "array",
"description": "Tab definitions for tabs field type",
"items": {
"$ref": "#/definitions/tabDefinition"
},
"minItems": 1
},
"orientation": {
"type": "string",
"description": "Tab orientation (horizontal or vertical)",
"enum": ["horizontal", "vertical"],
"default": "horizontal"
},
"fields": {
"type": "array",
"description": "Nested field definitions for container fields (metabox, group, repeater)",
"items": {
"$ref": "#/definitions/field"
}
},
"button_label": {
"type": "string",
"description": "Label for add button in repeater fields",
"default": "Add Item"
},
"row_label": {
"type": "string",
"description": "Label template for repeater rows (use {{index}} for row number)",
"default": "Item {{index}}"
},
"min_rows": {
"type": "integer",
"description": "Minimum number of rows in repeater",
"minimum": 0,
"default": 0
},
"max_rows": {
"type": "integer",
"description": "Maximum number of rows in repeater",
"minimum": 1
},
"content": {
"type": "string",
"description": "HTML content to display (for custom_html field type)"
},
"allowed_tags": {
"type": "object",
"description": "Allowed HTML tags for wp_kses sanitization (for custom_html field type)",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "boolean"
}
}
},
"raw_html": {
"type": "boolean",
"description": "Output HTML without sanitization (for custom_html field type, use with caution)",
"default": false
},
"button_text": {
"type": "string",
"description": "Text for the upload button (for upload field type)",
"default": "Select File"
},
"remove_text": {
"type": "string",
"description": "Text for the remove button (for upload field type)",
"default": "Remove"
},
"library_type": {
"type": "string",
"description": "Filter media library by type (for upload field type)",
"enum": ["", "image", "video", "audio", "application"]
},
"preview": {
"type": "boolean",
"description": "Show preview for images (for upload field type)",
"default": true
}
}
},
"tabDefinition": {
"type": "object",
"required": ["id", "label"],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"description": "Unique tab identifier",
"pattern": "^[a-z_][a-z0-9_]*$",
"minLength": 1,
"maxLength": 64
},
"label": {
"type": "string",
"description": "Tab label shown to users",
"minLength": 1,
"maxLength": 100
},
"icon": {
"type": "string",
"description": "Dashicon class for the tab",
"pattern": "^dashicons-",
"examples": ["dashicons-admin-settings", "dashicons-edit"]
},
"description": {
"type": "string",
"description": "Optional description shown in tab content",
"maxLength": 255
},
"fields": {
"type": "array",
"description": "Fields within this tab",
"items": {
"$ref": "#/definitions/field"
}
}
}
}
}
}