WP-API / menus-endpoints

Feature plugin for Menu Endpoints
43 stars 12 forks source link

Validation #31

Closed spacedmonkey closed 4 years ago

spacedmonkey commented 5 years ago

Improved validation of saving and displaying fields. Now correct types are checks and fields sanitized.

Much of this code is copied from wp-cli. See this.

There is more sanitize found in the customizer here.

Also improved all interger values defaults and allowed values.

This PR validation against the following use cases.

Other changes.

Fixes #38

spacedmonkey commented 5 years ago

@kadamwhite All your feedback as been actioned.

draganescu commented 4 years ago

I have tested and indeed it also fixes #38 .

spacedmonkey commented 4 years ago

Hey @spacedmonkey this is great! It's a big-ish PR I'd say.

Should all the new things in prepare_item_for_database be covered by new tests?

I know this PR is a got a little to large. It got a little out of hand. To stop it getting any bigger and become impossible to review, I have agree with the rest of the team to just get this merged and work on another PR with test. Hopefully this will make the code review process quicker and mean we don't get blocked like this again.

TimothyBJacobs commented 4 years ago

Going ahead and merging this. I'd really like to see tests for handling the negative menu item IDs and reordering.