Commit 40b0dc8
committed
feat: implement comprehensive SCF JSON schema validation framework with tests and documentation
- Add SCF_JSON_Validator wrapper class (350+ lines) with comprehensive validation logic
- Add 4 test files with 60+ test methods covering schema, save/load, meta, and fixtures
- Add 5 test fixtures (1 valid complete, 4 invalid demonstrating common errors)
- Add 5 comprehensive SCF example field groups covering all field types:
* Basic fields (text, textarea, email, url, number, password)
* Content fields (wysiwyg, oembed, image, file, gallery)
* Choice fields (select, checkbox, radio, button_group, true_false)
* Relational fields (link, post_object, page_link, relationship, taxonomy, user)
* Date/time fields (date_picker, date_time_picker, time_picker, color_picker)
* Advanced fields (group, repeater, flexible_content with layouts)
- Add 3 npm scripts for validation: test:scf, test:scf:verbose, validate:scf
- Enhance TESTING.md with 350+ lines of comprehensive SCF validation documentation
- Add README.md files to all directories with development guidance
Validation Features:
- Root structure validation (required properties: key, title, fields, location)
- Field group key format (must start with 'group_')
- Field type enumeration validation (40+ field types)
- Field key format validation (non-layout fields must start with 'field_')
- Location rules validation (param, operator, value requirements)
- Display properties validation (position, style, label_placement, hide_on_screen)
- Sub-fields validation for containers (group, repeater, flexible_content)
- Layout validation for flexible_content fields
Test Coverage:
- test-scf-json-schema-validation.php: 20+ methods covering schema structure
- test-scf-json-save-load.php: 9 methods covering file I/O operations
- test-scf-json-meta.php: 11 methods covering meta setup and reset
- test-scf-json-fixtures.php: 16 methods covering real-world fixture validation
Documentation:
- Comprehensive TESTING.md section with validation overview
- Field group structure examples (minimal and complete)
- Common validation issues with solutions
- CI/CD integration guidance
- npm script usage instructions1 parent 22c1505 commit 40b0dc8
File tree
81 files changed
+5778
-56
lines changed- .devcontainer
- .github
- agents
- instructions
- prompts
- workflows
- .husky
- .wordpress-org
- assets
- bin
- docs
- config
- inc
- languages
- parts
- patterns
- reports
- scf-json
- schema
- src
- blocks
- components
- hooks
- scss
- utils
- templates
- tests
- agents
- e2e
- fixtures
- js
- php
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
81 files changed
+5778
-56
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
0 commit comments