Closed vedanshujain closed 4 years ago
note that code standard failures are unrelated to changes in this PR. I will address them in different PR directly.
Combined test results with core for different WP version in the merge/src PR : https://travis-ci.org/github/woocommerce/woocommerce/builds/715231616
@jonathansadowski so an example is, we will not be able to support a setting option where value is of type object. Whereas previously with mixed
type we would have as there is no validation basically.
That said, we currently only define text, email, number, color, password, textarea, select, multiselect, radio, image_width and checkbox.
setting types and all of these can be supported by the new type that I added. Only multiselect
here needs array support rest of these can be supported by the string. (I went and explored all the settings from wp-json/wc/v3/settings/
endpoint to verify.)
This PR has a couple of changes in response to https://core.trac.wordpress.org/changeset/48306
mixed
is now changed to appropriate scalar type with addition ofnull
. So final type is nowarray( {scalar}, 'null' )
.array
,string
,null
, and if an array, then allowed item type isstring
ornull
. This means that only one of nesting is now allowed for WooCommerce settings via API. Would appreciate the feedback here on if this is backward compatible or not. Looks like we have to mandatorily define the child properties if the native property is array or object. This means that just saying that type isobject
is not allowed, we have to define all the properties of children (and their children, etc if any).type => date-time
totype => string, format => date-time
.