Skip to content

Conversation

@priethor
Copy link
Contributor

What

Workaround for WordPress Abilities API until WordPress/wordpress-develop#10557 lands.

Resolve JSON Schema $ref references before passing schemas to the WordPress Abilities API to ensure proper validation of internal post type abilities.

Why

  • WordPress Abilities API validates inputs using JSON Schema, but uses JSON Schema V4 and doesn't understand $ref references
  • SCF's schemas use $ref for nested structures, improving reusability (e.g., forbidden terms that apply to all schemas)
  • Without resolution, the API cannot properly validate these nested structures
  • Once core adds the input/output validation filters, we could hook into validation instead and apply our own JSON V7 validator directly

How

Adding a method to recursively inline $ref definitions, and calling this method when preparing entity schemas for the Abilities API.

Testing Instructions

  1. Ensure you are running WordPress 6.9 with Abilities API support
  2. Install the MCP Adapter plugin
  3. Create an application password
  4. Use your favorite agent to connect to your site using the application password
  5. Create a field group with location rules (e.g., "Show on post type = post")
  6. Verify the field group ability registers without internal validation errors

@priethor priethor self-assigned this Dec 16, 2025
@priethor priethor added the [Type] Bug Something isn't working label Dec 16, 2025
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props priethor.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 12.28%. Comparing base (8edf4ba) to head (65c51ea).
⚠️ Report is 2 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #288      +/-   ##
============================================
+ Coverage     12.23%   12.28%   +0.05%     
- Complexity     4287     4293       +6     
============================================
  Files           284      284              
  Lines         34690    34714      +24     
============================================
+ Hits           4244     4266      +22     
- Misses        30446    30448       +2     
Flag Coverage Δ
e2e 30.69% <ø> (-0.03%) ⬇️
javascript 2.60% <ø> (ø)
phpunit 7.65% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@priethor priethor merged commit 98f532d into trunk Dec 17, 2025
10 checks passed
@priethor priethor deleted the fix/json-schema-refs branch December 17, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant