Skip to content

Commit 49b795e

Browse files
committed
feat: Add UUID support to JSON schema and TypeScript snapshots
1 parent 58ca924 commit 49b795e

14 files changed

Lines changed: 51 additions & 9 deletions

crates/schematic/tests/snapshots/generator_test__json_schema__not_required.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ expression: "fs::read_to_string(file).unwrap()"
141141
}
142142
]
143143
},
144+
"uuid": {
145+
"type": "string",
146+
"format": "uuid"
147+
},
144148
"vector": {
145149
"description": "This is a list of strings.",
146150
"type": "array",

crates/schematic/tests/snapshots/generator_test__json_schema__partials.snap

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@ expression: "fs::read_to_string(file).unwrap()"
248248
}
249249
]
250250
},
251+
"uuid": {
252+
"anyOf": [
253+
{
254+
"type": "string",
255+
"format": "uuid"
256+
},
257+
{
258+
"type": "null"
259+
}
260+
]
261+
},
251262
"vector": {
252263
"description": "This is a list of strings.",
253264
"anyOf": [
@@ -389,6 +400,7 @@ expression: "fs::read_to_string(file).unwrap()"
389400
"time",
390401
"tomlValue",
391402
"url",
403+
"uuid",
392404
"vector",
393405
"version",
394406
"versionReq",
@@ -528,6 +540,10 @@ expression: "fs::read_to_string(file).unwrap()"
528540
}
529541
]
530542
},
543+
"uuid": {
544+
"type": "string",
545+
"format": "uuid"
546+
},
531547
"vector": {
532548
"description": "This is a list of strings.",
533549
"type": "array",

crates/schematic/tests/snapshots/generator_test__json_schema__with_markdown_descs.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ expression: "fs::read_to_string(file).unwrap()"
2828
"time",
2929
"tomlValue",
3030
"url",
31+
"uuid",
3132
"vector",
3233
"version",
3334
"versionReq",
@@ -169,6 +170,10 @@ expression: "fs::read_to_string(file).unwrap()"
169170
}
170171
]
171172
},
173+
"uuid": {
174+
"type": "string",
175+
"format": "uuid"
176+
},
172177
"vector": {
173178
"description": "This is a list of strings.",
174179
"type": "array",

crates/schematic/tests/snapshots/generator_test__json_schema__with_titles.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ expression: "fs::read_to_string(file).unwrap()"
2727
"time",
2828
"tomlValue",
2929
"url",
30+
"uuid",
3031
"vector",
3132
"version",
3233
"versionReq",
@@ -186,6 +187,11 @@ expression: "fs::read_to_string(file).unwrap()"
186187
}
187188
]
188189
},
190+
"uuid": {
191+
"title": "uuid",
192+
"type": "string",
193+
"format": "uuid"
194+
},
189195
"vector": {
190196
"title": "vector",
191197
"description": "This is a list of strings.",

crates/schematic/tests/snapshots/generator_test__typescript__const_enums.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n const_enum: true,\n enum_format: EnumFormat::Enum,\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{\n const_enum: true, enum_format: EnumFormat::Enum,\n ..TypeScriptOptions::default()\n})"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -60,6 +60,7 @@ export interface GenConfig {
6060
time: string;
6161
tomlValue: unknown | null;
6262
url: string | null;
63+
uuid: string;
6364
/** This is a list of strings. */
6465
vector: string[];
6566
version: string | null;

crates/schematic/tests/snapshots/generator_test__typescript__enums.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n enum_format: EnumFormat::Enum,\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{ enum_format: EnumFormat::Enum, ..TypeScriptOptions::default() })"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -60,6 +60,7 @@ export interface GenConfig {
6060
time: string;
6161
tomlValue: unknown | null;
6262
url: string | null;
63+
uuid: string;
6364
/** This is a list of strings. */
6465
vector: string[];
6566
version: string | null;

crates/schematic/tests/snapshots/generator_test__typescript__exclude_refs.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n exclude_references: vec![\"BasicEnum\".into(), \"AnotherType\".into()],\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{\n exclude_references: vec![\"BasicEnum\".into(), \"AnotherType\".into()],\n ..TypeScriptOptions::default()\n})"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -53,6 +53,7 @@ export interface GenConfig {
5353
time: string;
5454
tomlValue: unknown | null;
5555
url: string | null;
56+
uuid: string;
5657
/** This is a list of strings. */
5758
vector: string[];
5859
version: string | null;

crates/schematic/tests/snapshots/generator_test__typescript__external_types.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n external_types: HashMap::from_iter([(\"./externals\".into(),\n vec![\"BasicEnum\".into(), \"AnotherType\".into()])]),\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{\n external_types:\n HashMap::from_iter([(\"./externals\".into(),\n vec![\"BasicEnum\".into(), \"AnotherType\".into()])]),\n ..TypeScriptOptions::default()\n})"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -58,6 +58,7 @@ export interface GenConfig {
5858
time: string;
5959
tomlValue: unknown | null;
6060
url: string | null;
61+
uuid: string;
6162
/** This is a list of strings. */
6263
vector: string[];
6364
version: string | null;

crates/schematic/tests/snapshots/generator_test__typescript__no_refs.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n disable_references: true,\n indent_char: \" \".into(),\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{\n disable_references: true, indent_char: \" \".into(),\n ..TypeScriptOptions::default()\n})"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -65,6 +65,7 @@ export interface GenConfig {
6565
time: string;
6666
tomlValue: unknown | null;
6767
url: string | null;
68+
uuid: string;
6869
/** This is a list of strings. */
6970
vector: string[];
7071
version: string | null;

crates/schematic/tests/snapshots/generator_test__typescript__object_aliases.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
source: crates/schematic/tests/generator_test.rs
3-
expression: "generate(TypeScriptOptions {\n object_format: ObjectFormat::Type,\n ..TypeScriptOptions::default()\n })"
3+
expression: "generate(TypeScriptOptions\n{ object_format: ObjectFormat::Type, ..TypeScriptOptions::default() })"
44
---
55
// Automatically generated by schematic. DO NOT MODIFY!
66

@@ -56,6 +56,7 @@ export type GenConfig = {
5656
time: string,
5757
tomlValue: unknown | null,
5858
url: string | null,
59+
uuid: string,
5960
/** This is a list of strings. */
6061
vector: string[],
6162
version: string | null,

0 commit comments

Comments
 (0)