use Mojo::JSON qw( true false );
{
backend => 'test://localhost/yancy.data.json',
editor => { require_user => undef, },
schema => {
blog => {
title => 'Blog Posts',
required => [qw( title markdown slug )],
example => {
title => 'Title',
markdown => "# Title\n\nMarkdown content",
slug => 'title',
},
'x-list-columns' => [
{ title => 'Post', template => '{title} ({slug})' },
],
type => 'object',
properties => {
id => {
type => 'integer',
readOnly => true,
},
title => {
'x-order' => 1,
type => 'string',
},
markdown => {
'x-order' => 3,
type => 'string',
format => 'markdown',
'x-html-field' => 'html',
},
html => {
type => 'string',
format => 'html',
},
slug => {
'x-order' => 2,
type => 'string',
description => 'The URL part for this blog post',
},
username => {
'x-foreign-key' => 'users',
},
},
},
people => {
title => 'People',
description => 'These are the people we all know',
'x-list-columns' => [ { title => 'Name', template => '<a href="/people/{id}">{name}</a>', field => 'name' }, 'email', 'contact' ],
'x-view-url' => '/people',
'x-view-item-url' => '/people/{id}',
required => [ 'name', 'email' ],
example => {
name => 'John Doe',
email => 'john@example.com',
},
type => 'object',
properties => {
id => {
title => 'ID',
type => 'integer',
readOnly => true,
},
name => {
title => 'Name',
'x-order' => 1,
type => 'string',
},
email => {
title => 'E-mail',
'x-order' => 2,
type => 'string',
format => 'email',
},
age => {
'x-order' => 5,
title => 'Age',
type => 'integer',
minimum => 0,
maximum => 200,
},
phone => {
title => 'Phone Number',
'x-order' => 4,
type => 'string',
format => 'tel',
},
gender => {
'x-order' => 7,
title => 'Preferred Gender',
type => 'string',
enum => [qw( male female )],
},
contact => {
title => 'Can Contact?',
'x-order' => 3,
type => 'boolean',
},
birthday => {
title => 'Date of Birth',
'x-order' => 6,
type => 'string',
format => 'date',
},
},
},
users => {
title => 'Users',
'x-id-field' => 'username',
'x-list-columns' => [ 'username', 'email' ],
required => [ 'username', 'email' ],
type => 'object',
properties => {
username => {
type => 'string',
},
email => {
type => 'string',
format => 'email',
},
password => {
type => 'string',
format => 'password',
#writeOnly => true,
},
created => {
type => 'string',
format => 'date-time',
readOnly => true,
},
notes => {
type => [ 'string', 'null' ],
format => 'textarea',
},
plugin => {
type => 'string',
},
avatar => {
type => 'string',
format => 'filepath',
},
},
},
},
}