romaricdrigon / MetaYaml

A powerful schema validator!
MIT License
104 stars 21 forks source link

Prototype with choices - impossible? #22

Closed OnkelTem closed 5 years ago

OnkelTem commented 5 years ago

I cannot declare a schema with prototype of choices.

              'process' => [ '_type' => 'prototype', '_required' => TRUE, '_min_items' => 1, '_prototype' => [
                '_type' => '_choice', '_required' => TRUE, '_choices' => [
                  0 => [ '_type' => 'array', '_required' => FALSE, '_ignore_extra_keys' => TRUE, '_children' => [
                    'plugin' => [ '_type' => 'text',  '_required' => TRUE ],
                  ]],
                  1 => [ '_type' => 'prototype', '_required' => FALSE, '_min_items' => 1, '_prototype' => [
                    '_type' => 'array', '_required' => FALSE, '_ignore_extra_keys' => TRUE, '_children' => [
                      'plugin' => [ '_type' => 'text',  '_required' => TRUE ],
                    ]
                  ]],
                ]
              ]],

Is this is a documented limitation or a bug?

OnkelTem commented 5 years ago

@romaricdrigon hello?

OnkelTem commented 5 years ago

Omg, '_type' => '_choice' should be '_type' => 'choice'

romaricdrigon commented 5 years ago

Hello @OnkelTem , I was on holidays last week, without my computer nor even mobile network. I'm glad you found the solution!