mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:10:45 +00:00
perf: optimize plugin schema validation
This commit is contained in:
@@ -399,6 +399,20 @@ const accountSchema = z.object({
|
||||
const configSchema = buildChannelConfigSchema(accountSchema);
|
||||
```
|
||||
|
||||
If you already author the contract as JSON Schema or TypeBox, use the direct helper so OpenClaw can skip Zod-to-JSON-Schema conversion on metadata paths:
|
||||
|
||||
```typescript
|
||||
import { Type } from "typebox";
|
||||
import { buildJsonChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
|
||||
|
||||
const configSchema = buildJsonChannelConfigSchema(
|
||||
Type.Object({
|
||||
token: Type.Optional(Type.String()),
|
||||
allowFrom: Type.Optional(Type.Array(Type.String())),
|
||||
}),
|
||||
);
|
||||
```
|
||||
|
||||
For third-party plugins, the cold-path contract is still the plugin manifest: mirror the generated JSON Schema into `openclaw.plugin.json#channelConfigs` so config schema, setup, and UI surfaces can inspect `channels.<id>` without loading runtime code.
|
||||
|
||||
## Setup wizards
|
||||
|
||||
Reference in New Issue
Block a user