Skip to content

Commit 1bf8d20

Browse files
hyperpolymathclaude
andcommitted
feat: add V-lang API for configuration orchestration
Config validation, format types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 203b452 commit 1bf8d20

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

api/v/conflow.v

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
//
4+
// Conflow V-lang API — Configuration orchestration client.
5+
module conflow
6+
7+
pub enum ConfigFormat {
8+
nickel
9+
toml
10+
json
11+
yaml
12+
}
13+
14+
pub enum ApplyResult {
15+
applied
16+
no_change
17+
conflict
18+
@error
19+
}
20+
21+
pub struct ConfigEntry {
22+
pub:
23+
key string
24+
value string
25+
format ConfigFormat
26+
}
27+
28+
fn C.conflow_validate_config(config_ptr &u8, format int) int
29+
fn C.conflow_valid_format(format int) int
30+
31+
// validate checks if a configuration string is valid for the given format.
32+
pub fn validate(config string, format ConfigFormat) bool {
33+
return C.conflow_validate_config(config.str, int(format)) == 0
34+
}
35+
36+
// is_valid_format checks if a format ID is supported.
37+
pub fn is_valid_format(format ConfigFormat) bool {
38+
return C.conflow_valid_format(int(format)) == 1
39+
}

0 commit comments

Comments
 (0)