+13
-5
src/honk.gleam
+13
-5
src/honk.gleam
···
77
let message = case e {
78
errors.InvalidSchema(msg) -> msg
79
errors.DataValidation(msg) -> msg
80
-
errors.LexiconNotFound(msg) -> "Lexicon not found: " <> msg
81
}
82
// Clean up leading ": " if present
83
-
let clean_message = case string.starts_with(message, ": ") {
84
True -> string.drop_start(message, 2)
85
False -> message
86
}
87
-
let error_msg = lex_id <> "#" <> def_name <> ": " <> clean_message
88
case dict.get(errors_acc, lex_id) {
89
Ok(existing_errors) ->
90
dict.insert(errors_acc, lex_id, [
···
221
case simplifile.is_directory(path) {
222
Ok(True) -> validate_directory(path)
223
Ok(False) -> {
224
-
io.println_error("Error: Path is neither a file nor a directory: " <> path)
225
Nil
226
}
227
Error(_) -> {
···
367
case total_errors {
368
0 ->
369
io.println(
370
-
"\nAll " <> int.to_string(total) <> " schemas validated successfully.",
371
)
372
_ ->
373
io.println_error(
···
77
let message = case e {
78
errors.InvalidSchema(msg) -> msg
79
errors.DataValidation(msg) -> msg
80
+
errors.LexiconNotFound(msg) ->
81
+
"Lexicon not found: " <> msg
82
}
83
// Clean up leading ": " if present
84
+
let clean_message = case
85
+
string.starts_with(message, ": ")
86
+
{
87
True -> string.drop_start(message, 2)
88
False -> message
89
}
90
+
let error_msg =
91
+
lex_id <> "#" <> def_name <> ": " <> clean_message
92
case dict.get(errors_acc, lex_id) {
93
Ok(existing_errors) ->
94
dict.insert(errors_acc, lex_id, [
···
225
case simplifile.is_directory(path) {
226
Ok(True) -> validate_directory(path)
227
Ok(False) -> {
228
+
io.println_error(
229
+
"Error: Path is neither a file nor a directory: " <> path,
230
+
)
231
Nil
232
}
233
Error(_) -> {
···
373
case total_errors {
374
0 ->
375
io.println(
376
+
"\nAll "
377
+
<> int.to_string(total)
378
+
<> " schemas validated successfully.",
379
)
380
_ ->
381
io.println_error(
+2
-1
src/honk/validation/field/reference.gleam
+2
-1
src/honk/validation/field/reference.gleam
···
44
45
// Validate that the reference can be resolved (only for global refs with full context)
46
case string.starts_with(ref_str, "#") {
47
-
True -> Ok(Nil) // Local ref - will be validated in same lexicon
48
False -> {
49
// Global ref - check it exists in catalog if we have a current lexicon
50
case context.current_lexicon_id(ctx) {
···
44
45
// Validate that the reference can be resolved (only for global refs with full context)
46
case string.starts_with(ref_str, "#") {
47
+
True -> Ok(Nil)
48
+
// Local ref - will be validated in same lexicon
49
False -> {
50
// Global ref - check it exists in catalog if we have a current lexicon
51
case context.current_lexicon_id(ctx) {