Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

fix: Wrong callback function for the Rest API endpoints.#79

Closed
levinbaria wants to merge 1 commit intoWordPress:trunkfrom
levinbaria:fix/schema-callback-function
Closed

fix: Wrong callback function for the Rest API endpoints.#79
levinbaria wants to merge 1 commit intoWordPress:trunkfrom
levinbaria:fix/schema-callback-function

Conversation

@levinbaria
Copy link

@levinbaria levinbaria commented Sep 17, 2025

Fix the broken REST schema callback in the WP_REST_Abilities_List_Controller, as it is calling get_public_item_schema instead of get_item_schema.

Fixes #78

@github-actions
Copy link

github-actions bot commented Sep 17, 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: levinbaria <levinbaria@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Co-authored-by: justlevine <justlevine@git.wordpress.org>

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

@levinbaria levinbaria marked this pull request as draft September 17, 2025 06:07
@levinbaria levinbaria marked this pull request as ready for review September 17, 2025 06:08
@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.33%. Comparing base (59d8ec6) to head (0607006).
⚠️ Report is 5 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk      #79   +/-   ##
=========================================
  Coverage     83.33%   83.33%           
  Complexity       96       96           
=========================================
  Files             8        8           
  Lines           516      516           
=========================================
  Hits            430      430           
  Misses           86       86           
Flag Coverage Δ
unit 83.33% <100.00%> (ø)

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.

@gziolo gziolo added the [Type] Bug Something isn't working label Sep 17, 2025
@gziolo gziolo modified the milestone: v0.2.0 Sep 17, 2025
@gziolo gziolo requested a review from emdashcodes September 17, 2025 07:09
@gziolo
Copy link
Member

gziolo commented Sep 17, 2025

@emdashcodes, can you confirm it is a bug? get_public_item_schema is method on WP_REST_Controller and it calls internally get_item_schema so everything seems coorect. There is a unit test in place that passes with both implementations.

@justlevine
Copy link
Contributor

justlevine commented Sep 17, 2025

get_public_item_schema is method on WP_REST_Controller and it calls internally get_item_schema so everything seems correct.

That (and the passing tests) is only because we're not currently using arg_options anywhere.

If there isn't a specific reason to deviate, I'd recommend we follow core as proposed here(implement get_item_schema, call get_public_item_schema) instead of turning this into an inconsistent implementation detail contributors/maintainers need to watch out for if/when the schema warrants changes.

(Code LGTM and I don't think this needs tests either, not "approving" so it doesn't get accidently merged before @emdashcodes can weigh in)

@gziolo
Copy link
Member

gziolo commented Sep 23, 2025

If there isn't a specific reason to deviate, I'd recommend we follow core as proposed here(implement get_item_schema, call get_public_item_schema) instead of turning this into an inconsistent implementation detail contributors/maintainers need to watch out for if/when the schema warrants changes.

Let's keep things as they are 👍🏻

@levinbaria, thank you for bringing this potential issue to our attention.

@gziolo gziolo closed this Sep 23, 2025
@emdashcodes
Copy link
Contributor

emdashcodes commented Sep 23, 2025

@emdashcodes, can you confirm it is a bug? get_public_item_schema is method on WP_REST_Controller and it calls internally get_item_schema so everything seems coorect.

I'm sorry for missing this one last week while I was AFK a few days.

From my understanding, this is how we want to do things. I based this on core which only passes get_public_item_schema to schema. https://github.com/search?q=repo%3AWordPress%2FWordPress%20get_public_item_schema&type=code.

get_item_schema is only defined and called internally: https://github.com/search?q=repo%3AWordPress%2FWordPress+get_item_schema&type=code&p=3.

If there isn't a specific reason to deviate, I'd recommend we follow core as proposed here(implement get_item_schema, call get_public_item_schema) instead of turning this into an inconsistent implementation detail contributors/maintainers need to watch out for if/when the schema warrants changes.

Yup, this is exactly how things are implemented right now.

get_item_schema -

get_public_item_schema -

'schema' => array( $this, 'get_public_item_schema' ),

(Code LGTM and I don't think this needs tests either, not "approving" so it doesn't get accidently merged before @emdashcodes can weigh in)

Just to clarify -- we don't want this change. trunk is already doing this the correct way.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

[Type] Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REST Abilities List Controller calling wrong callback for the schema.

4 participants