Skip to content

Commit 9857318

Browse files
porco-rsclaude
andcommitted
Fix CI: cargo fmt, germanic-macros version, include_str path
- cargo fmt fixes formatting in pre_validate.rs and main.rs - Revert germanic-macros to v0.1.1 (unchanged in AP-5) so publish dry-run can resolve the dependency on crates.io - Copy practice schema into crate directory so include_str! works in packaged tarball (publish --dry-run verification) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7b8c618 commit 9857318

6 files changed

Lines changed: 99 additions & 17 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ tracing = "0.1"
5151
tracing-subscriber = "0.3"
5252

5353
[workspace.package]
54-
version = "0.2.0"
54+
version = "0.1.1"
5555
edition = "2024"
5656
rust-version = "1.85"
5757
license = "MIT OR Apache-2.0"

crates/germanic/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
[package]
1010
name = "germanic"
11-
version.workspace = true
11+
version = "0.2.0"
1212
edition.workspace = true
1313
rust-version.workspace = true
1414
license.workspace = true
@@ -38,7 +38,7 @@ mcp = ["dep:rmcp", "dep:tokio", "dep:schemars", "dep:tracing", "dep:tracing-subs
3838

3939
[dependencies]
4040
# Re-export our macros so users only need `use germanic::GermanicSchema`
41-
germanic-macros = { path = "../germanic-macros", version = "0.2.0" }
41+
germanic-macros = { path = "../germanic-macros", version = "0.1.1" }
4242

4343
# Serialization
4444
serde.workspace = true
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
"schema_id": "de.gesundheit.praxis.v1",
3+
"version": 1,
4+
"fields": {
5+
"name": {
6+
"type": "string",
7+
"required": true
8+
},
9+
"bezeichnung": {
10+
"type": "string",
11+
"required": true
12+
},
13+
"adresse": {
14+
"type": "table",
15+
"required": true,
16+
"fields": {
17+
"strasse": {
18+
"type": "string",
19+
"required": true
20+
},
21+
"hausnummer": {
22+
"type": "string"
23+
},
24+
"plz": {
25+
"type": "string",
26+
"required": true
27+
},
28+
"ort": {
29+
"type": "string",
30+
"required": true
31+
},
32+
"land": {
33+
"type": "string",
34+
"default": "DE"
35+
}
36+
}
37+
},
38+
"praxisname": {
39+
"type": "string"
40+
},
41+
"telefon": {
42+
"type": "string"
43+
},
44+
"email": {
45+
"type": "string"
46+
},
47+
"website": {
48+
"type": "string"
49+
},
50+
"terminbuchung_url": {
51+
"type": "string"
52+
},
53+
"oeffnungszeiten": {
54+
"type": "string"
55+
},
56+
"kurzbeschreibung": {
57+
"type": "string"
58+
},
59+
"schwerpunkte": {
60+
"type": "[string]"
61+
},
62+
"therapieformen": {
63+
"type": "[string]"
64+
},
65+
"qualifikationen": {
66+
"type": "[string]"
67+
},
68+
"sprachen": {
69+
"type": "[string]"
70+
},
71+
"privatpatienten": {
72+
"type": "bool",
73+
"default": "false"
74+
},
75+
"kassenpatienten": {
76+
"type": "bool",
77+
"default": "false"
78+
}
79+
}
80+
}

crates/germanic/src/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,12 @@ fn cmd_compile(schema_name: &str, input: &PathBuf, output: Option<&std::path::Pa
186186
// 3. Compile via Dynamic Mode (unified validation pipeline)
187187
let grm_bytes = {
188188
// Embedded schema definition (compile-time)
189-
let schema_json = include_str!(
190-
"../../../schemas/definitions/de/de.gesundheit.praxis.v1.schema.json"
191-
);
189+
let schema_json = include_str!("../schemas/de.gesundheit.praxis.v1.schema.json");
192190
let schema: germanic::dynamic::schema_def::SchemaDefinition =
193191
serde_json::from_str(schema_json)
194192
.context("Built-in practice schema definition invalid")?;
195193

196-
let data: serde_json::Value =
197-
serde_json::from_str(&json).context("Invalid JSON")?;
194+
let data: serde_json::Value = serde_json::from_str(&json).context("Invalid JSON")?;
198195

199196
germanic::dynamic::compile_dynamic_from_values(&schema, &data)
200197
.context("Compilation failed")?

crates/germanic/src/pre_validate.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ fn check_value(value: &serde_json::Value, path: &str, errors: &mut Vec<String>,
9898
));
9999
}
100100
for (i, item) in arr.iter().enumerate() {
101-
let item_path = format!(
102-
"{}[{}]",
103-
if path.is_empty() { "(root)" } else { path },
104-
i
105-
);
101+
let item_path = format!("{}[{}]", if path.is_empty() { "(root)" } else { path }, i);
106102
check_value(item, &item_path, errors, depth + 1);
107103
}
108104
}
@@ -162,7 +158,9 @@ mod tests {
162158

163159
#[test]
164160
fn test_pre_validate_array_too_large() {
165-
let elements: Vec<String> = (0..MAX_ARRAY_ELEMENTS + 1).map(|i| format!("\"x{}\"", i)).collect();
161+
let elements: Vec<String> = (0..MAX_ARRAY_ELEMENTS + 1)
162+
.map(|i| format!("\"x{}\"", i))
163+
.collect();
166164
let json = format!(r#"{{"items": [{}]}}"#, elements.join(","));
167165
let value: serde_json::Value = serde_json::from_str(&json).unwrap();
168166
let err = pre_validate(&json, &value).unwrap_err();
@@ -184,7 +182,9 @@ mod tests {
184182
#[test]
185183
fn test_pre_validate_collects_all_errors() {
186184
let long_string = "x".repeat(MAX_STRING_LENGTH + 1);
187-
let elements: Vec<String> = (0..MAX_ARRAY_ELEMENTS + 1).map(|i| format!("\"x{}\"", i)).collect();
185+
let elements: Vec<String> = (0..MAX_ARRAY_ELEMENTS + 1)
186+
.map(|i| format!("\"x{}\"", i))
187+
.collect();
188188
let json = format!(
189189
r#"{{"big": "{}", "many": [{}]}}"#,
190190
long_string,
@@ -193,7 +193,12 @@ mod tests {
193193
let value: serde_json::Value = serde_json::from_str(&json).unwrap();
194194
let err = pre_validate(&json, &value).unwrap_err();
195195
// Should have at least 2 errors: string too long + array too large
196-
assert!(err.len() >= 2, "Expected at least 2 errors, got {}: {:?}", err.len(), err);
196+
assert!(
197+
err.len() >= 2,
198+
"Expected at least 2 errors, got {}: {:?}",
199+
err.len(),
200+
err
201+
);
197202
}
198203

199204
#[test]

0 commit comments

Comments
 (0)