Page MenuHomePhabricator

"pages" property does not allow for integers and arrays of integers
Closed, DeclinedPublic


Author: molly.white5

The code that I took from EventLogging only allows arrays to contain one type of value. The "pages" property should allow for something like the following:

[2, [5,8]]

This would indicate that the section included pages 2, 5, 6, 7, 8.

Right now the validation either allows only numbers, which would require the JSON to be formatted:

[2, 5, 6, 7, 8]

or only arrays, which would require the JSON to be formatted:

[[2], [5,8]]

Both of these seem a little silly, so it seems like it would be worth adjusting the code to allow for more than one type of value, and, ideally, pushing the changes back to EventLogging as well.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:05 AM
bzimport set Reference to bz51063.

I'm not able to reproduce this; can you provide some additional details?

Here's what I tried:

$schema = array( 'properties' => array(
    'collection' => array(
        'type' => 'array',
) );

$obj = array( 'collection' => array( 8, "hello", array(6) ) );
var_dump ( efSchemaValidate( $obj, $schema ) ); // output:


molly.white5 wrote:

Sure. The schema that I am using is The relevant bits are lines 179–199. Is this the incorrect way to indicate that an array should contain numbers or arrays of numbers?

In your example, why is the string passing the validation?

molly.white5 wrote:

The "Refactoring of Proofread Page extension" is working on a system to populate book pages with the <pages index> tags, and so we are stepping back from that feature. The "pages" property will be removed from the schema entirely.