Skip to content

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

@zoot

Description

@zoot

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions