-
-
Notifications
You must be signed in to change notification settings - Fork 159
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 #1020 from samchon/features/plugin
Add ContentMediaType and JsonSchemaPlugin tags
- Loading branch information
Showing
95 changed files
with
1,984 additions
and
37 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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { TagBase } from "./TagBase"; | ||
|
||
export type ContentMediaType<Value extends string> = TagBase<{ | ||
target: "string"; | ||
kind: "contentMediaType"; | ||
value: undefined; | ||
schema: { | ||
contentMediaType: Value; | ||
}; | ||
}>; |
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,8 @@ | ||
import { TagBase } from "./TagBase"; | ||
|
||
export type JsonSchemaPlugin<Schema extends object> = TagBase<{ | ||
target: "string" | "boolean" | "number" | "array"; | ||
kind: "jsonPlugin"; | ||
value: undefined; | ||
schema: Schema; | ||
}>; |
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
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
14 changes: 14 additions & 0 deletions
14
test/src/features/issues/test_issue_jsonSchema_contentMediaType.ts
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,14 @@ | ||
import typia, { tags } from "typia"; | ||
|
||
import { TestValidator } from "../../helpers/TestValidator"; | ||
|
||
export const test_issue_jsonSchema_contentMediaType = () => { | ||
const app: typia.IJsonApplication = | ||
typia.json.application< | ||
[string & tags.ContentMediaType<"application/json">] | ||
>(); | ||
TestValidator.equals("contentType")(app.schemas[0])({ | ||
type: "string", | ||
contentMediaType: "application/json", | ||
} as any); | ||
}; |
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,18 @@ | ||
import typia, { tags } from "typia"; | ||
|
||
import { TestValidator } from "../../helpers/TestValidator"; | ||
|
||
export const test_issue_jsonSchema_plugin = () => { | ||
const app: typia.IJsonApplication = typia.json.application< | ||
[ | ||
string & | ||
tags.JsonSchemaPlugin<{ | ||
"x-typia-easy-to-learn": true; | ||
}>, | ||
] | ||
>(); | ||
TestValidator.equals("plugin")(app.schemas[0])({ | ||
type: "string", | ||
"x-typia-easy-to-learn": true, | ||
} as any); | ||
}; |
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.