Skip to content

Conversation

@jorgefilipecosta
Copy link
Member

Apparently draft-04 of JSON schema allows the top level default, that we are using, but ajv validator errors if a top level default is used, it also error if null or undefined is passed as input.

This PR fixes the issue, we remove the default from the compile schema and use it as the input when it is defined.

Testing

On core switch to PR (which has required core changes to be draft-04 complient and work correctly, like removing examples and return JSON containing a default of {} instead of []).
Paste the following on the browser console:

const envInfoAbility = await wp.abilities.getAbility(
	'core/get-environment-info'
);
const envInfoResult = await wp.abilities.executeAbility(
	'core/get-environment-info'
);
await wp.abilities.registerAbility( {
	...envInfoAbility,
	name: 'core/get-environment-info-client',
	callback: () => envInfoResult,
} );


const siteInfoAbility = await wp.abilities.getAbility(
	'core/get-site-info'
);
const siteInfoResult = await wp.abilities.executeAbility(
	'core/get-site-info'
);
await wp.abilities.registerAbility( {
	...siteInfoAbility,
	name: 'core/get-site-info-cli',
	callback: () => siteInfoResult,
} );
[await wp.abilities.executeAbility( 'core/get-site-info-cli' ), await wp.abilities.executeAbility( 'core/get-environment-info-client' ) ]

Verify both abilities execute with success.

@github-actions
Copy link

github-actions bot commented Nov 12, 2025

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.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: gziolo <[email protected]>

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 Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.46%. Comparing base (61b515d) to head (0c8a900).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@             Coverage Diff              @@
##              trunk     #144      +/-   ##
============================================
+ Coverage     80.39%   80.46%   +0.06%     
  Complexity      178      178              
============================================
  Files            20       20              
  Lines          1474     1474              
  Branches        119      119              
============================================
+ Hits           1185     1186       +1     
+ Misses          289      288       -1     
Flag Coverage Δ
javascript 94.61% <100.00%> (+0.29%) ⬆️
unit 76.31% <ø> (ø)

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.

@jorgefilipecosta jorgefilipecosta force-pushed the fix/validation-handle-the-top-level-default branch from a4484a3 to 9b3a130 Compare November 12, 2025 17:19
Co-authored-by: Greg Ziółkowski <[email protected]>
@gziolo gziolo added the [Type] Bug Something isn't working label Nov 13, 2025
@jorgefilipecosta jorgefilipecosta merged commit 0a1cda6 into trunk Nov 13, 2025
20 checks passed
@jorgefilipecosta jorgefilipecosta deleted the fix/validation-handle-the-top-level-default branch November 13, 2025 10:27
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.

3 participants