This repository has been archived by the owner on Oct 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
82 lines (75 loc) · 2.3 KB
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
use phf_codegen;
use std::env;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;
fn main() {
let path = Path::new(&env::var("OUT_DIR").unwrap()).join("codegen.rs");
let mut file = BufWriter::new(File::create(&path).unwrap());
write!(&mut file, "#[allow(clippy::unreadable_literal)]\n").unwrap();
write!(&mut file, "static PROPERTY_KEYS: phf::Set<&'static str> = ").unwrap();
phf_codegen::Set::new()
.entry("properties")
.entry("patternProperties")
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
write!(&mut file, "#[allow(clippy::unreadable_literal)]\n").unwrap();
write!(
&mut file,
"static NON_SCHEMA_KEYS: phf::Set<&'static str> = "
)
.unwrap();
phf_codegen::Set::new()
.entry("properties")
.entry("patternProperties")
.entry("dependencies")
.entry("definitions")
.entry("anyOf")
.entry("allOf")
.entry("oneOf")
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
write!(&mut file, "#[allow(clippy::unreadable_literal)]\n").unwrap();
write!(
&mut file,
"static BOOLEAN_SCHEMA_ARRAY_KEYS: phf::Set<&'static str> = "
)
.unwrap();
phf_codegen::Set::new()
.entry("allOf")
.entry("anyOf")
.entry("items")
.entry("oneOf")
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
write!(&mut file, "#[allow(clippy::unreadable_literal)]\n").unwrap();
write!(&mut file, "static FINAL_KEYS: phf::Set<&'static str> = ").unwrap();
phf_codegen::Set::new()
.entry("enum")
.entry("required")
.entry("type")
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
write!(&mut file, "#[allow(clippy::unreadable_literal)]\n").unwrap();
write!(
&mut file,
"const ALLOW_NON_CONSUMED_KEYS: phf::Set<&'static str> = "
)
.unwrap();
phf_codegen::Set::new()
.entry("definitions")
.entry("$schema")
.entry("$id")
.entry("default")
.entry("title")
.entry("description")
.entry("format")
.entry("examples")
.build(&mut file)
.unwrap();
write!(&mut file, ";\n").unwrap();
}