kibi-core 0.22.3 → 0.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/schema/entities.pl +2 -1
- package/schema/validation.pl +15 -0
package/package.json
CHANGED
package/schema/entities.pl
CHANGED
|
@@ -29,7 +29,8 @@ entity_property(_, priority, atom).
|
|
|
29
29
|
entity_property(_, severity, atom).
|
|
30
30
|
entity_property(_, links, list).
|
|
31
31
|
entity_property(_, text_ref, uri).
|
|
32
|
-
|
|
32
|
+
% Workspace-relative source paths only (no absolute / .. escapes).
|
|
33
|
+
entity_property(_, sourceFile, workspace_relpath).
|
|
33
34
|
% Provenance of any authored entity: a JSON object (kind, ref, approved_by,
|
|
34
35
|
% recorded_at) naming who authored it and on what authority.
|
|
35
36
|
entity_property(_, origin, list_or_json).
|
package/schema/validation.pl
CHANGED
|
@@ -50,11 +50,26 @@ check_kind(datetime, V) :- string(V). % accept ISO strings for now
|
|
|
50
50
|
check_kind(list, V) :- is_list(V).
|
|
51
51
|
check_kind(list_or_json, V) :- is_list(V) ; string(V) ; atom(V).
|
|
52
52
|
check_kind(uri, V) :- string(V).
|
|
53
|
+
% Non-empty workspace-relative path: reject absolute forms and `..` segments.
|
|
54
|
+
check_kind(workspace_relpath, V) :-
|
|
55
|
+
string(V),
|
|
56
|
+
string_length(V, Len),
|
|
57
|
+
Len > 0,
|
|
58
|
+
\+ workspace_relpath_absolute(V),
|
|
59
|
+
split_string(V, "/\\", "", Parts),
|
|
60
|
+
\+ member("..", Parts).
|
|
53
61
|
check_kind(integer, V) :- integer(V).
|
|
54
62
|
check_kind(number, V) :- number(V).
|
|
55
63
|
check_kind(boolean, true).
|
|
56
64
|
check_kind(boolean, false).
|
|
57
65
|
|
|
66
|
+
workspace_relpath_absolute(V) :- sub_string(V, 0, 1, _, "/").
|
|
67
|
+
workspace_relpath_absolute(V) :-
|
|
68
|
+
string_length(V, Len),
|
|
69
|
+
Len >= 2,
|
|
70
|
+
sub_string(V, 1, 1, _, ":").
|
|
71
|
+
workspace_relpath_absolute(V) :- sub_string(V, 0, 2, _, "\\\\").
|
|
72
|
+
|
|
58
73
|
% Fallback false
|
|
59
74
|
check_kind(_, _) :- fail.
|
|
60
75
|
|