-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Codegen for Check Types, fix union picker, regex filter
- Loading branch information
1 parent
7f90614
commit 803cec8
Showing
34 changed files
with
755 additions
and
129 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,3 +247,35 @@ test_deserializer!( | |
] | ||
} | ||
); | ||
|
||
const CONTACT_INFO: &str = r#" | ||
class PhoneNumber { | ||
value string @check({{this|regex_match("\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}")}}, "valid_phone_number") | ||
foo int? // A nullable marker indicating PhoneNumber was chosen. | ||
} | ||
class EmailAddress { | ||
value string @check({{this|regex_match("^[_]*([a-z0-9]+(\.|_*)?)+@([a-z][a-z0-9-]+(\.|-*\.))+[a-z]{2,6}$")}}, "valid_email") | ||
bar int? // A nullable marker indicating EmailAddress was chosen. | ||
} | ||
class ContactInfo { | ||
primary PhoneNumber | EmailAddress | ||
} | ||
"#; | ||
|
||
test_deserializer!( | ||
test_check1, | ||
CONTACT_INFO, | ||
r#"{"primary": {"value": "908-797-8281"}}"#, | ||
FieldType::Class("ContactInfo".to_string()), | ||
{"primary": {"value": "908-797-8281", "foo": null}} | ||
); | ||
|
||
test_deserializer!( | ||
test_check2, | ||
CONTACT_INFO, | ||
r#"{"primary": {"value": "[email protected]"}}"#, | ||
FieldType::Class("ContactInfo".to_string()), | ||
{"primary": {"value": "[email protected]", "bar": null}} | ||
); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ sugar_path = "1.2.0" | |
walkdir.workspace = true | ||
semver = "1.0.23" | ||
colored = "2.1.0" | ||
itertools = "0.13.0" |
This file contains 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
Oops, something went wrong.