-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1009 from samchon/features/title
Custom JSON schema definer
- Loading branch information
Showing
202 changed files
with
14,849 additions
and
10,508 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import typia, { tags } from "typia"; | ||
|
||
type Monetary<Value extends string> = tags.TagBase<{ | ||
target: "number"; | ||
kind: "monetary"; | ||
value: Value; | ||
schema: { | ||
"x-monetary": Value; | ||
}; | ||
}>; | ||
|
||
type Placeholder<Value extends string> = tags.TagBase<{ | ||
target: "string"; | ||
kind: "placeholder"; | ||
value: Value; | ||
schema: { | ||
"x-placeholder": Value; | ||
}; | ||
}>; | ||
|
||
console.log( | ||
JSON.stringify( | ||
typia.json.application< | ||
[ | ||
number & Monetary<"dollar">, | ||
string & | ||
tags.Format<"email"> & | ||
Placeholder<"Insert your email address please">, | ||
] | ||
>(), | ||
null, | ||
2, | ||
), | ||
); |
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
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
Oops, something went wrong.