Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 0f74aae

Browse files
authored
chore: add json schema (#225)
Signed-off-by: azjezz <azjezz@protonmail.com>
1 parent 843e7f2 commit 0f74aae

28 files changed

+11971
-128
lines changed

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ doctest = false
1515
pretty_assertions = "1.3.0"
1616

1717
[[bin]]
18-
name = "snapshot"
18+
name = "php-parser-snapshot"
1919
path = "bin/snapshot.rs"
2020

21+
[[bin]]
22+
name = "php-parser-schema"
23+
path = "bin/schema.rs"
24+
2125
[dependencies]
26+
schemars = "0.8.11"
2227
serde = { version = "1.0.149", features = ["derive"] }
2328
serde_json = { version = "1.0.89" }
2429

Justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ build:
77

88
# regenerate test snapshots
99
snapshot:
10-
cargo run --bin snapshot
10+
cargo run --bin php-parser-snapshot
11+
12+
# regenerate schema
13+
schema:
14+
cargo run --bin php-parser-schema
1115

1216
# detect linting problems.
1317
lint:

bin/schema.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use schemars::schema_for;
2+
3+
use php_parser_rs::parser::ast::Program;
4+
5+
fn main() {
6+
let schema = schema_for!(Program);
7+
println!("{}", serde_json::to_string_pretty(&schema).unwrap());
8+
}

0 commit comments

Comments
 (0)