Replace Type.Any() with Type.Unknown() across all source files
Type.Unknown() is canonical per ADR-012. Both produce identical JSON Schema
output but Unknown communicates intent. Changed in src/graphs/types.ts (metadata,
schema fields) and src/sqlite/tables/{nodes,edges}.ts (AttributesSchema).
This commit is contained in:
@@ -3,14 +3,14 @@ import { type Static, type TSchema, Type } from "@alkdev/typebox";
|
|||||||
export const BaseNodeAttributes: TSchema = Type.Object({
|
export const BaseNodeAttributes: TSchema = Type.Object({
|
||||||
created: Type.Optional(Type.String({ format: "date-time" })),
|
created: Type.Optional(Type.String({ format: "date-time" })),
|
||||||
modified: Type.Optional(Type.String({ format: "date-time" })),
|
modified: Type.Optional(Type.String({ format: "date-time" })),
|
||||||
metadata: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type BaseNodeAttributes = Static<typeof BaseNodeAttributes>;
|
export type BaseNodeAttributes = Static<typeof BaseNodeAttributes>;
|
||||||
|
|
||||||
export const BaseEdgeAttributes: TSchema = Type.Object({
|
export const BaseEdgeAttributes: TSchema = Type.Object({
|
||||||
type: Type.String(),
|
type: Type.String(),
|
||||||
metadata: Type.Optional(Type.Record(Type.String(), Type.Any())),
|
metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type BaseEdgeAttributes = Static<typeof BaseEdgeAttributes>;
|
export type BaseEdgeAttributes = Static<typeof BaseEdgeAttributes>;
|
||||||
@@ -29,14 +29,14 @@ export type GraphConfig = Static<typeof GraphConfig>;
|
|||||||
|
|
||||||
export const NodeType: TSchema = Type.Object({
|
export const NodeType: TSchema = Type.Object({
|
||||||
name: Type.String(),
|
name: Type.String(),
|
||||||
schema: Type.Any(),
|
schema: Type.Unknown(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type NodeType = Static<typeof NodeType>;
|
export type NodeType = Static<typeof NodeType>;
|
||||||
|
|
||||||
export const EdgeType: TSchema = Type.Object({
|
export const EdgeType: TSchema = Type.Object({
|
||||||
name: Type.String(),
|
name: Type.String(),
|
||||||
schema: Type.Any(),
|
schema: Type.Unknown(),
|
||||||
allowedSourceTypes: Type.Optional(Type.Array(Type.String())),
|
allowedSourceTypes: Type.Optional(Type.Array(Type.String())),
|
||||||
allowedTargetTypes: Type.Optional(Type.Array(Type.String())),
|
allowedTargetTypes: Type.Optional(Type.Array(Type.String())),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { commonCols } from "./common.ts";
|
|||||||
import { graphs } from "./graphs.ts";
|
import { graphs } from "./graphs.ts";
|
||||||
import { nodes } from "./nodes.ts";
|
import { nodes } from "./nodes.ts";
|
||||||
|
|
||||||
const AttributesSchema = Type.Record(Type.String(), Type.Any());
|
const AttributesSchema = Type.Record(Type.String(), Type.Unknown());
|
||||||
|
|
||||||
export const edges = sqliteTable("edges", {
|
export const edges = sqliteTable("edges", {
|
||||||
...commonCols,
|
...commonCols,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { type Static, Type } from "@alkdev/typebox";
|
|||||||
import { commonCols } from "./common.ts";
|
import { commonCols } from "./common.ts";
|
||||||
import { graphs } from "./graphs.ts";
|
import { graphs } from "./graphs.ts";
|
||||||
|
|
||||||
const AttributesSchema = Type.Record(Type.String(), Type.Any());
|
const AttributesSchema = Type.Record(Type.String(), Type.Unknown());
|
||||||
|
|
||||||
export const nodes = sqliteTable("nodes", {
|
export const nodes = sqliteTable("nodes", {
|
||||||
...commonCols,
|
...commonCols,
|
||||||
|
|||||||
Reference in New Issue
Block a user