Catalyst-ActionRole-JSV
view release on metacpan or search on metacpan
lib/Catalyst/ActionRole/JSV.pm view on Meta::CPAN
...
}
# lookup.json (json schema draft4 validation)
{
"title": "Lookup item",
"type": "object",
"properties": {
"item_id": {
"type": "integer",
"minLength": 1,
"maxLength": 9,
"captureargs": 1 # In the case of URL CaptureArgs
},
"paramX": {
"type": "string",
"minLength": 8,
"maxLength": 12
},
},
"required": ["item_id"]
}
=head1 DESCRIPTION
Catalyst::ActionRole::JSV is JSON Schema validator for Catalyst actions.
Internally use the json schema draft4 validator called JSV.
=head2 Error Response
On error it returns 400 http response status. The stash key to set the error message is 'View::JSON expose_stash' key.
The default key if omitted is 'json'.
$c->stash->{'View::JSON expose_stash key'} = {message => 'JSV->validate->get_error'}
myapp.yml config
name: MyApp
View::JSON:
expose_stash: 'json'
=head1 SEE ALSO
=over 2
=item L<Catalyst::Controller>
=item L<Catalyst::View::JSON>
=item L<JSV::Validator>
=back
Catalyst Advent Calendar 2013 / How to implement a super-simple REST API with Catalyst
http://www.catalystframework.org/calendar/2013/26
=head1 AUTHOR
Masaaki Saito E<lt>masakyst.public@gmail.comE<gt>
=head1 COPYRIGHT
Copyright 2017- Masaaki Saito
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
=cut
( run in 2.666 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )