preaction / Yancy

The Best Web Framework Deserves the Best Content Management System
http://preaction.me/yancy/
Other
54 stars 21 forks source link

When setting readOnly => 1 mojolicious throws a boolean error #148

Open zoot opened 1 year ago

zoot commented 1 year ago

I am discovering Yancy by following http://preaction.me/article/yancy-todo to build my application.

Perl 5.36.1

If I try to disable the editing of the integer 'id' field in a database table 'users', with the 'readOnly' flag:

plugin Yancy => {
    backend => { mysql => app->mariadb },
    route => '/admin',
    read_schema => 1,
    schema => {
        users => {
            title => 'Users',
            properties => {
                id => {
                    type => 'integer',
                    readOnly => 1
                }
            },
        },
    },
};

Mojolicious throws this error:

Can't load application from file \
"/path/to/app.pl": /definitions/users/properties/id/readOnly: Expected boolean \
- got number.Compilation failed in require at (eval 76) line 1.

I can't for the life of me figure out why, since Perl considers 1 as true and all the examples I've found on-line, including the manpage docs use readOnly => 1. Removing that line, resolves the error.

Any ideas?