Last active
May 27, 2022 20:21
-
-
Save jjn1056/655625aff3a188fc8bfb23621b31de40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Local::MyApp::Model::User; | |
use Moose; | |
use Valiant::Params -types; | |
has 'first_name' => (is=>'ro', required=>1, param=>1); | |
has 'last_name' => (is=>'ro', required=>1, param=>1); | |
has 'profile' => (is=>'ro', required=>1, param=>{type=>'::Profile'}); | |
sub register_type { | |
my ($class) = @_; | |
return User => sub { | |
return $class->new(@_); | |
}; | |
} | |
package Local::MyApp::Model::User; | |
use Moose; | |
use Valiant::OpenAPI; | |
has 'first_name' => (is=>'ro', required=>1); | |
has 'last_name' => (is=>'ro', required=>1); | |
has 'profile' => (is=>'ro', required=>1); | |
api_property first_name => (required=>1, type=>Str, min_length=>2, max_lenth=14); | |
api_property last_name => (required=>1, type=>Str, min_length=>2, max_lenth=24); | |
api_property profile => (required=>1, model=>'Profile'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.