File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed
aiscript-directive/src/validator Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -266,8 +266,8 @@ impl FromDirective for Box<dyn Validator> {
266266 "any" => Ok ( Box :: new ( AnyValidator :: from_directive ( directive) ?) ) ,
267267 "not" => Ok ( Box :: new ( NotValidator :: from_directive ( directive) ?) ) ,
268268 "date" => Ok ( Box :: new ( DateValidator :: from_directive ( directive) ?) ) ,
269- "array" => Ok ( Box :: new ( AnyValidator :: from_directive ( directive) ?) ) , // Add this line
270- "regex" => Ok ( Box :: new ( RegexValidator :: from_directive ( directive) ?) ) , // Add support for regex directive
269+ "array" => Ok ( Box :: new ( AnyValidator :: from_directive ( directive) ?) ) ,
270+ "regex" => Ok ( Box :: new ( RegexValidator :: from_directive ( directive) ?) ) ,
271271 v => Err ( format ! ( "Invalid validators: @{}" , v) ) ,
272272 }
273273 }
Original file line number Diff line number Diff line change @@ -954,13 +954,16 @@ mod tests {
954954
955955 let route = result. unwrap ( ) ;
956956 assert_eq ! ( route. prefix, "/api" ) ;
957-
957+
958958 let endpoint1 = & route. endpoints [ 0 ] ;
959959 assert_eq ! ( endpoint1. path_specs[ 0 ] . method, HttpMethod :: Get ) ;
960960 assert_eq ! ( endpoint1. path_specs[ 0 ] . path, "/get-messages" ) ;
961-
961+
962962 let endpoint2 = & route. endpoints [ 1 ] ;
963963 assert_eq ! ( endpoint2. path_specs[ 0 ] . method, HttpMethod :: Post ) ;
964- assert_eq ! ( endpoint2. path_specs[ 0 ] . path, "/user-profile/update-settings" ) ;
964+ assert_eq ! (
965+ endpoint2. path_specs[ 0 ] . path,
966+ "/user-profile/update-settings"
967+ ) ;
965968 }
966969}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ pub use agent::{Agent, run_agent};
77use openai_api_rs:: v1:: api:: OpenAIClient ;
88pub use prompt:: { PromptConfig , prompt_with_config} ;
99
10+ #[ allow( unused) ]
1011pub ( crate ) fn openai_client ( ) -> OpenAIClient {
1112 OpenAIClient :: builder ( )
1213 . with_api_key ( env:: var ( "OPENAI_API_KEY" ) . unwrap ( ) . to_string ( ) )
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ post /api/register {
1414 return { "success": true };
1515}
1616
17- get /api/validate_phone {
17+ get /api/validate-phone {
1818 query {
19- """Phone number validation (( XXX) -XXX-XXXX format)"""
19+ """Phone number validation (XXX-XXX-XXXX format)"""
2020 @regex(pattern="^\d{3}-\d{3}-\d{4}$")
2121 phone: str
2222 }
You can’t perform that action at this time.
0 commit comments