dto icon indicating copy to clipboard operation
dto copied to clipboard

Why I get this message?

Open yyyyeeeeesss opened this issue 6 years ago • 0 comments

Hello! I have a dto class with such schema:

protected $schema = [
        'type'       => 'object',
        'properties' => [
            'place_id'         => [
                'type' => ['integer', 'null'],
            ],
        ],
        'default'    => [
            'place_id'         => null,
        ],
    ];

If I set place_id = 12, I get such error:

"type":"null" allows only null values. Pass a literal null or define your "type" as an array of types.

Why? I want to set this property in integer or in null, but it isn't work.If place_id in schema will be string instead integer (ex. - 'place_id' => [ 'type' => ['string', 'null'], ...]) - it is works.

version - 3.2.7

yyyyeeeeesss avatar Feb 01 '19 10:02 yyyyeeeeesss