primitive-admin 1.3.0-alpha.2 → 1.3.0-alpha.3
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/README.md +46 -22
- package/dist/bin/primitive.js +11 -4
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/apps.d.ts +3 -6
- package/dist/src/commands/apps.js +7 -22
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-passkeys.js +1 -1
- package/dist/src/commands/auth-passkeys.js.map +1 -1
- package/dist/src/commands/auth.js +1 -1
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +8 -0
- package/dist/src/commands/blob-buckets.js +23 -8
- package/dist/src/commands/blob-buckets.js.map +1 -1
- package/dist/src/commands/db3.js +6 -0
- package/dist/src/commands/db3.js.map +1 -1
- package/dist/src/commands/documents.js +3 -0
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/functions.js +13 -4
- package/dist/src/commands/functions.js.map +1 -1
- package/dist/src/commands/init.js +11 -0
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +1 -1
- package/dist/src/commands/rule-sets.js +0 -1
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/sync.d.ts +27 -13
- package/dist/src/commands/sync.js +105 -112
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/usage.d.ts +12 -2
- package/dist/src/commands/usage.js +115 -5
- package/dist/src/commands/usage.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +80 -5
- package/dist/src/lib/api-client.js +21 -9
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/cli-manifest.d.ts +9 -0
- package/dist/src/lib/cli-manifest.js +19 -3
- package/dist/src/lib/cli-manifest.js.map +1 -1
- package/dist/src/lib/config-object-descriptor.js +3 -5
- package/dist/src/lib/config-object-descriptor.js.map +1 -1
- package/dist/src/lib/db3-export.js +1 -0
- package/dist/src/lib/db3-export.js.map +1 -1
- package/dist/src/lib/document-ingest.d.ts +7 -1
- package/dist/src/lib/document-ingest.js +27 -2
- package/dist/src/lib/document-ingest.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +6 -0
- package/dist/src/lib/function-bundle.js +14 -0
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-db-types.d.ts +8 -0
- package/dist/src/lib/function-db-types.js +15 -0
- package/dist/src/lib/function-db-types.js.map +1 -1
- package/dist/src/lib/function-log-lines.js +6 -1
- package/dist/src/lib/function-log-lines.js.map +1 -1
- package/dist/src/lib/function-log-row.d.ts +8 -0
- package/dist/src/lib/function-log-row.js +59 -0
- package/dist/src/lib/function-log-row.js.map +1 -1
- package/dist/src/lib/generated-command-status.js +6 -5
- package/dist/src/lib/generated-command-status.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +29 -4
- package/dist/src/lib/generated-config-surfaces.js +160 -49
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/log-inspection.d.ts +37 -2
- package/dist/src/lib/log-inspection.js +15 -3
- package/dist/src/lib/log-inspection.js.map +1 -1
- package/dist/src/lib/outside-project.d.ts +49 -0
- package/dist/src/lib/outside-project.js +133 -0
- package/dist/src/lib/outside-project.js.map +1 -0
- package/dist/src/lib/primitive-declaration.d.ts +8 -1
- package/dist/src/lib/primitive-declaration.js +40 -8
- package/dist/src/lib/primitive-declaration.js.map +1 -1
- package/dist/src/lib/schema-codegen/compiledSpace.d.ts +16 -0
- package/dist/src/lib/schema-codegen/compiledSpace.js +23 -11
- package/dist/src/lib/schema-codegen/compiledSpace.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-field-table.js +38 -3
- package/dist/src/lib/schema-codegen/generated-field-table.js.map +1 -1
- package/dist/src/lib/schema-codegen/generated-schema-refs.js +172 -19
- package/dist/src/lib/schema-codegen/generated-schema-refs.js.map +1 -1
- package/dist/src/lib/schema-codegen/namedRefs.js +8 -2
- package/dist/src/lib/schema-codegen/namedRefs.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaDocs.js +10 -4
- package/dist/src/lib/schema-codegen/schemaDocs.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaIR.d.ts +12 -2
- package/dist/src/lib/schema-codegen/schemaIR.js +26 -2
- package/dist/src/lib/schema-codegen/schemaIR.js.map +1 -1
- package/dist/src/lib/schema-codegen/schemaToTs.d.ts +2 -1
- package/dist/src/lib/schema-codegen/schemaToTs.js +8 -5
- package/dist/src/lib/schema-codegen/schemaToTs.js.map +1 -1
- package/dist/src/lib/usage-meters.js +1 -0
- package/dist/src/lib/usage-meters.js.map +1 -1
- package/package.json +2 -2
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
* (one file declares it) or `{ "ref": "<file>.<Name>" }` (the key names one
|
|
50
50
|
* family, and that is `schemas/`). The def's compiled form is inlined, copied
|
|
51
51
|
* whole: its interior is never compiled again. Beside `ref` only
|
|
52
|
-
* `description`, `required` and `nullable` may sit
|
|
52
|
+
* `description`, `required` and `nullable` may sit, and `pick` or `omit`
|
|
53
|
+
* where the ref names a db3 model (below). A ref that cannot resolve,
|
|
53
54
|
* an ambiguous short form, a tombstoned file and the reserved `platform`
|
|
54
55
|
* prefix are refusals. Without an index, every ref behaves as above.
|
|
55
56
|
*
|
|
@@ -65,6 +66,15 @@
|
|
|
65
66
|
* opaque, as a shared def is, and every db3 refusal names the projection and
|
|
66
67
|
* how it was chosen.
|
|
67
68
|
*
|
|
69
|
+
* A subset of a model (#6308): beside a `ref` that resolves to a db3 model, or
|
|
70
|
+
* to a `schemas/` def whose root carries a projection marker, `pick = [...]`
|
|
71
|
+
* keeps the listed fields and closes the object, and `omit = [...]` leaves
|
|
72
|
+
* the listed fields out and keeps the projection's openness. Each kept field
|
|
73
|
+
* keeps its schema, in the projection's order, and the node keeps the marker;
|
|
74
|
+
* `pick` and `omit` never reach the compiled document. Beside a function's or
|
|
75
|
+
* a prompt's schema, or a plain def, they are refused, as is a field the
|
|
76
|
+
* projection does not have. The provenance still hashes the whole projection.
|
|
77
|
+
*
|
|
68
78
|
* Pure and deterministic, importing only the keyword table, the provenance
|
|
69
79
|
* module and the db3 bridge's projection names, so the CLI vendors it beside the descriptor
|
|
70
80
|
* (`cli/scripts/gen-schema-descriptor.mjs`) and both sides compile a schema to
|
|
@@ -680,8 +690,16 @@ function resolveShared(index, ref, position = "input") {
|
|
|
680
690
|
.filter(([, entry]) => !entry.tombstone && !entry.error && entry.names.includes(ref.name))
|
|
681
691
|
.map(([file]) => file)
|
|
682
692
|
.sort();
|
|
683
|
-
if (candidates.length === 0)
|
|
693
|
+
if (candidates.length === 0) {
|
|
694
|
+
// A file that declares the name but cannot be compiled is the better report.
|
|
695
|
+
const broken = [...index.files.entries()]
|
|
696
|
+
.filter(([, entry]) => !entry.tombstone && entry.error && entry.names.includes(ref.name))
|
|
697
|
+
.map(([file]) => file)
|
|
698
|
+
.sort();
|
|
699
|
+
if (broken.length > 0)
|
|
700
|
+
return resolveInFile(index, broken[0], ref.name);
|
|
684
701
|
return unresolved(`no schemas/ file declares ${ref.name}. Fix the name, or add [defs.${ref.name}] to a schemas/ file`);
|
|
702
|
+
}
|
|
685
703
|
if (candidates.length > 1) {
|
|
686
704
|
return {
|
|
687
705
|
ok: false,
|
|
@@ -863,23 +881,92 @@ function allowedSibling(key) {
|
|
|
863
881
|
}
|
|
864
882
|
/** What may sit beside a `ref`: the def replaces the node, so only these three (intent, Decisions). */
|
|
865
883
|
const REF_SIBLINGS = new Set(["description", "required", "nullable"]);
|
|
884
|
+
/** The keys beside a `ref` that name a subset of a db3 model's fields (#6308). */
|
|
885
|
+
const SUBSET_KEYS = ["pick", "omit"];
|
|
886
|
+
/** A ref node's subset: the key written and its field names, or null when it writes neither. */
|
|
887
|
+
function subsetOf(node) {
|
|
888
|
+
for (const key of SUBSET_KEYS) {
|
|
889
|
+
if (Object.prototype.hasOwnProperty.call(node, key))
|
|
890
|
+
return { key, names: node[key] };
|
|
891
|
+
}
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
/** Why a `pick` or `omit` value is not a non-empty list of distinct field names, or null when it is one. */
|
|
895
|
+
function subsetShapeError(value) {
|
|
896
|
+
if (!Array.isArray(value))
|
|
897
|
+
return "it is not an array";
|
|
898
|
+
if (value.length === 0)
|
|
899
|
+
return "it is empty";
|
|
900
|
+
const seen = new Set();
|
|
901
|
+
for (let index = 0; index < value.length; index++) {
|
|
902
|
+
const name = value[index];
|
|
903
|
+
if (typeof name !== "string" || name === "")
|
|
904
|
+
return `entry ${index} is not a non-empty string`;
|
|
905
|
+
if (seen.has(name))
|
|
906
|
+
return `${JSON.stringify(name)} is listed twice`;
|
|
907
|
+
seen.add(name);
|
|
908
|
+
}
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* `base` restricted to a subset, its keys in place: `properties` holds the
|
|
913
|
+
* kept fields in `base`'s order, `required` the kept entries (dropped when
|
|
914
|
+
* none is), and a `pick` closes the object.
|
|
915
|
+
*/
|
|
916
|
+
function restrictTo(base, subset) {
|
|
917
|
+
const listed = new Set(subset.names);
|
|
918
|
+
const keep = (name) => (subset.key === "pick" ? listed.has(name) : !listed.has(name));
|
|
919
|
+
const out = {};
|
|
920
|
+
let closed = false;
|
|
921
|
+
for (const [key, value] of Object.entries(base)) {
|
|
922
|
+
if (key === "properties" && isPlainObject(value)) {
|
|
923
|
+
const properties = {};
|
|
924
|
+
for (const [name, schema] of Object.entries(value))
|
|
925
|
+
if (keep(name))
|
|
926
|
+
setOwn(properties, name, schema);
|
|
927
|
+
setOwn(out, key, properties);
|
|
928
|
+
}
|
|
929
|
+
else if (key === "required" && Array.isArray(value)) {
|
|
930
|
+
const required = value.filter((name) => typeof name === "string" && keep(name));
|
|
931
|
+
if (required.length > 0)
|
|
932
|
+
setOwn(out, key, required);
|
|
933
|
+
}
|
|
934
|
+
else if (key === "additionalProperties" && subset.key === "pick") {
|
|
935
|
+
setOwn(out, key, false);
|
|
936
|
+
closed = true;
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
if (key === "$comment" && subset.key === "pick" && !closed) {
|
|
940
|
+
setOwn(out, "additionalProperties", false);
|
|
941
|
+
closed = true;
|
|
942
|
+
}
|
|
943
|
+
setOwn(out, key, value);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
if (subset.key === "pick" && !closed)
|
|
947
|
+
setOwn(out, "additionalProperties", false);
|
|
948
|
+
return out;
|
|
949
|
+
}
|
|
866
950
|
class SiblingRefusal extends Error {
|
|
867
951
|
pointer;
|
|
868
952
|
key;
|
|
869
953
|
ref;
|
|
870
954
|
kind;
|
|
955
|
+
detail;
|
|
871
956
|
constructor(pointer, key, ref,
|
|
872
957
|
/**
|
|
873
958
|
* `dollar`: beside a `$ref`. `ref`: beside a `ref`. `required`: `required = true` beside a `ref`.
|
|
874
959
|
* `both`: a `$ref` and a `ref` together. `marker`: a `$comment` beside a `$ref` that resolves, directly or
|
|
875
960
|
* through aliases, to a db3 projection, which would replace the projection's marker.
|
|
961
|
+
* `subset`: a `pick` or `omit` that is malformed (`detail` says how) or beside a ref that is not to a db3 model.
|
|
876
962
|
*/
|
|
877
|
-
kind = "dollar") {
|
|
963
|
+
kind = "dollar", detail = "") {
|
|
878
964
|
super(key);
|
|
879
965
|
this.pointer = pointer;
|
|
880
966
|
this.key = key;
|
|
881
967
|
this.ref = ref;
|
|
882
968
|
this.kind = kind;
|
|
969
|
+
this.detail = detail;
|
|
883
970
|
}
|
|
884
971
|
}
|
|
885
972
|
/** The compile built enough inlined keys that the expansion is surely over the byte cap. */
|
|
@@ -934,6 +1021,8 @@ class Compiler {
|
|
|
934
1021
|
chainDefinitions = new WeakMap();
|
|
935
1022
|
/** A run's alias not built into the document, merged only to be hashed. */
|
|
936
1023
|
transient = new WeakMap();
|
|
1024
|
+
/** A run's base restricted by its last node's `pick` or `omit`, built once. */
|
|
1025
|
+
restricted = new WeakMap();
|
|
937
1026
|
/** Ref node → the ref as it resolved (a shared ref in its explicit form). */
|
|
938
1027
|
refTexts = new WeakMap();
|
|
939
1028
|
/** Ref node → the shared def it resolved to. */
|
|
@@ -1087,10 +1176,17 @@ class Compiler {
|
|
|
1087
1176
|
const target = found.entry.defs && Object.prototype.hasOwnProperty.call(found.entry.defs, found.def) ? found.entry.defs[found.def] : undefined;
|
|
1088
1177
|
if (!isPlainObject(target))
|
|
1089
1178
|
throw new Error(`the family index holds no compiled target for ${found.explicit}`);
|
|
1090
|
-
return {
|
|
1179
|
+
return {
|
|
1180
|
+
target,
|
|
1181
|
+
ref: found.explicit,
|
|
1182
|
+
shared: { file: found.file, def: found.def, entry: found.entry },
|
|
1183
|
+
family: found.family,
|
|
1184
|
+
...(found.family === "db3" ? { db3: true, note: projectionNote(shared.projection, shared.kind === "db3" && shared.explicit === true, this.position) } : {}),
|
|
1185
|
+
};
|
|
1091
1186
|
}
|
|
1092
|
-
/** Refuse a key beside a ref node that may not sit there
|
|
1093
|
-
checkSiblings(node, pointer,
|
|
1187
|
+
/** Refuse a key beside a ref node that may not sit there, and a subset its target cannot answer. */
|
|
1188
|
+
checkSiblings(node, pointer, step) {
|
|
1189
|
+
const db3 = step.db3 === true;
|
|
1094
1190
|
if (typeof node.$ref === "string") {
|
|
1095
1191
|
for (const key of Object.keys(node)) {
|
|
1096
1192
|
if (key === "$ref")
|
|
@@ -1110,9 +1206,43 @@ class Compiler {
|
|
|
1110
1206
|
continue;
|
|
1111
1207
|
if (key === "required" && !Array.isArray(node.required))
|
|
1112
1208
|
throw new SiblingRefusal(pointer, key, written, "required");
|
|
1113
|
-
if (!REF_SIBLINGS.has(key))
|
|
1209
|
+
if (!REF_SIBLINGS.has(key) && !SUBSET_KEYS.includes(key))
|
|
1114
1210
|
throw new SiblingRefusal(pointer, key, written, "ref");
|
|
1115
1211
|
}
|
|
1212
|
+
this.checkSubset(node, pointer, step, written);
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Check a ref node's `pick` or `omit` (#6308): its shape, that the ref names a
|
|
1216
|
+
* db3 model or a `schemas/` def that is one (by the family it resolved in,
|
|
1217
|
+
* never by the target's marker alone), and that every name is a field of
|
|
1218
|
+
* the target.
|
|
1219
|
+
*/
|
|
1220
|
+
checkSubset(node, pointer, step, written) {
|
|
1221
|
+
const subset = subsetOf(node);
|
|
1222
|
+
if (!subset)
|
|
1223
|
+
return;
|
|
1224
|
+
if (Object.prototype.hasOwnProperty.call(node, "pick") && Object.prototype.hasOwnProperty.call(node, "omit")) {
|
|
1225
|
+
throw new SiblingRefusal(pointer, "omit", written, "subset", "both");
|
|
1226
|
+
}
|
|
1227
|
+
const shape = subsetShapeError(subset.names);
|
|
1228
|
+
if (shape)
|
|
1229
|
+
throw new SiblingRefusal(pointer, subset.key, written, "subset", shape);
|
|
1230
|
+
const marker = parseDb3ProjectionMarker(step.target.$comment);
|
|
1231
|
+
const placed = step.family === "db3" || (step.family === "schemas" && marker !== null);
|
|
1232
|
+
if (!placed) {
|
|
1233
|
+
const names = step.family === "fn" ? "a function's schema" : step.family === "prompt" ? "a prompt's schema" : "a schemas/ def that is not a db3 model";
|
|
1234
|
+
throw new SiblingRefusal(pointer, subset.key, written, "subset", `it names ${names}`);
|
|
1235
|
+
}
|
|
1236
|
+
const properties = isPlainObject(step.target.properties) ? step.target.properties : {};
|
|
1237
|
+
const missing = subset.names.find((name) => !Object.prototype.hasOwnProperty.call(properties, name));
|
|
1238
|
+
if (missing === undefined)
|
|
1239
|
+
return;
|
|
1240
|
+
const projection = marker ? `${marker.projection} projection` : "projection";
|
|
1241
|
+
const whose = marker ? `model ${marker.model} of db3 type ${marker.type}` : "the model";
|
|
1242
|
+
const fields = Object.keys(properties);
|
|
1243
|
+
const note = step.note ?? (marker ? `${marker.projection} projection, as ${step.ref} holds it` : undefined);
|
|
1244
|
+
throw new SharedRefRefusal(FUNCTION_SCHEMA_REF_UNRESOLVED, pointer, `ref ${JSON.stringify(written)}${note ? ` (${note})` : ""}`, `${subset.key} names ${JSON.stringify(missing)}, which is not a field of the ${projection} of ${whose} ` +
|
|
1245
|
+
`(${fields.length > 0 ? `it has ${fields.join(", ")}` : "it has no fields"}). Fix the name, or add the field to the model`, [step.ref]);
|
|
1116
1246
|
}
|
|
1117
1247
|
/**
|
|
1118
1248
|
* Push `node`'s compiled form, or the tasks that produce it. `outer` are the
|
|
@@ -1147,7 +1277,7 @@ class Compiler {
|
|
|
1147
1277
|
const nodes = [];
|
|
1148
1278
|
let current = node;
|
|
1149
1279
|
for (;;) {
|
|
1150
|
-
this.checkSiblings(current, pointer, step
|
|
1280
|
+
this.checkSiblings(current, pointer, step);
|
|
1151
1281
|
nodes.push(current);
|
|
1152
1282
|
this.refTexts.set(current, step.ref);
|
|
1153
1283
|
if (step.shared) {
|
|
@@ -1238,18 +1368,19 @@ class Compiler {
|
|
|
1238
1368
|
* then each node's own, innermost to outermost. Built in one pass over the run.
|
|
1239
1369
|
*/
|
|
1240
1370
|
merge(run, index) {
|
|
1241
|
-
|
|
1371
|
+
// A `ref` node's own `pick`/`omit` shape its base, and are never written (#6308).
|
|
1372
|
+
const skips = (node, key) => (typeof node.$ref === "string" ? key === "$ref" : key === "ref" || key === "pick" || key === "omit");
|
|
1242
1373
|
const owner = new Map();
|
|
1243
1374
|
for (let level = index; level < run.nodes.length; level++) {
|
|
1244
|
-
const
|
|
1245
|
-
for (const key of Object.keys(
|
|
1246
|
-
if (key
|
|
1375
|
+
const node = run.nodes[level];
|
|
1376
|
+
for (const key of Object.keys(node)) {
|
|
1377
|
+
if (!skips(node, key) && !owner.has(key))
|
|
1247
1378
|
owner.set(key, level);
|
|
1248
1379
|
}
|
|
1249
1380
|
}
|
|
1250
1381
|
const merged = {};
|
|
1251
1382
|
let keys = 0;
|
|
1252
|
-
for (const [key, value] of Object.entries(run
|
|
1383
|
+
for (const [key, value] of Object.entries(this.baseOf(run))) {
|
|
1253
1384
|
if (owner.has(key))
|
|
1254
1385
|
continue;
|
|
1255
1386
|
setOwn(merged, key, value);
|
|
@@ -1266,6 +1397,21 @@ class Compiler {
|
|
|
1266
1397
|
}
|
|
1267
1398
|
return { merged, keys };
|
|
1268
1399
|
}
|
|
1400
|
+
/** The base a run's nodes merge over: its compiled target, restricted by the last node's `pick` or `omit`. */
|
|
1401
|
+
baseOf(run) {
|
|
1402
|
+
const last = run.nodes[run.nodes.length - 1];
|
|
1403
|
+
if (typeof last.$ref === "string" || !Object.prototype.hasOwnProperty.call(last, "ref"))
|
|
1404
|
+
return run.base;
|
|
1405
|
+
const subset = subsetOf(last);
|
|
1406
|
+
if (!subset)
|
|
1407
|
+
return run.base;
|
|
1408
|
+
let restricted = this.restricted.get(run);
|
|
1409
|
+
if (!restricted) {
|
|
1410
|
+
restricted = restrictTo(run.base, subset);
|
|
1411
|
+
this.restricted.set(run, restricted);
|
|
1412
|
+
}
|
|
1413
|
+
return restricted;
|
|
1414
|
+
}
|
|
1269
1415
|
/** Build the node `link` inlines into the document, counting its keys against the budget. */
|
|
1270
1416
|
build(link, pointer, outer = []) {
|
|
1271
1417
|
const { run, index } = link;
|
|
@@ -1626,12 +1772,19 @@ function siblingRefusal(field, error) {
|
|
|
1626
1772
|
? `${at}: "required" beside ref ${ref} must be the JSON Schema array of property names, such as required = ["amount"]; ` +
|
|
1627
1773
|
"required = true is the field-table spelling, which arrives with the field-table release."
|
|
1628
1774
|
: error.kind === "ref"
|
|
1629
|
-
? `${at}: ${key} beside ref ${ref} is not allowed. Beside ref only description, required and nullable may sit
|
|
1630
|
-
`because the def replaces the node; move ${key} into the def.`
|
|
1631
|
-
:
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1775
|
+
? `${at}: ${key} beside ref ${ref} is not allowed. Beside ref only description, required and nullable may sit ` +
|
|
1776
|
+
`(and pick or omit, beside a db3 model ref), because the def replaces the node; move ${key} into the def.`
|
|
1777
|
+
: error.kind === "subset"
|
|
1778
|
+
? error.detail === "both"
|
|
1779
|
+
? `${at}: "pick" and "omit" beside ref ${ref}: write one of them. pick lists the fields to keep, omit the fields to leave out.`
|
|
1780
|
+
: error.detail.startsWith("it names ")
|
|
1781
|
+
? `${at}: ${key} beside ref ${ref} cannot apply: ${error.detail.slice("it names ".length)}. ` +
|
|
1782
|
+
"pick and omit apply to a db3 model ref, or a schemas/ def that is a db3 model ref."
|
|
1783
|
+
: `${at}: ${key} beside ref ${ref} must be a non-empty array of distinct field names; ${error.detail}.`
|
|
1784
|
+
: `${at}: ${key} beside "$ref": ${ref} is not allowed. ` +
|
|
1785
|
+
"A resolved ref is replaced by its definition, so only annotations (description, title, default, examples, " +
|
|
1786
|
+
"an unknown key such as x-display) and nullable may sit beside it. Move the constraint into the definition, " +
|
|
1787
|
+
"or inline the definition.";
|
|
1635
1788
|
return { code: FUNCTION_SCHEMA_REF_SIBLING, path: error.pointer, chain: [error.ref], message };
|
|
1636
1789
|
}
|
|
1637
1790
|
/**
|