






















@@ -112,13 +112,25 @@ export type ConfigSchemaLookupChild = {
112112type?: string | string[];
113113required: boolean;
114114hasChildren: boolean;
115+reloadKind?: ConfigSchemaReloadKind;
115116hint?: ConfigUiHint;
116117hintPath?: string;
117118};
118119120+export type ConfigSchemaReloadKind = "restart" | "hot" | "none";
121+122+export type ConfigSchemaReloadMetadata = {
123+kind: ConfigSchemaReloadKind;
124+};
125+126+export type ConfigSchemaReloadMetadataResolver = (
127+path: string,
128+) => ConfigSchemaReloadMetadata | null | undefined;
129+119130export type ConfigSchemaLookupResult = {
120131path: string;
121132schema: JsonSchemaNode;
133+reloadKind?: ConfigSchemaReloadKind;
122134hint?: ConfigUiHint;
123135hintPath?: string;
124136children: ConfigSchemaLookupChild[];
@@ -750,19 +762,22 @@ function buildLookupChildren(
750762schema: JsonSchemaObject,
751763path: string,
752764uiHints: ConfigUiHints,
765+resolveReloadMetadata?: ConfigSchemaReloadMetadataResolver,
753766): ConfigSchemaLookupChild[] {
754767const children: ConfigSchemaLookupChild[] = [];
755768const required = new Set(schema.required ?? []);
756769757770const pushChild = (key: string, childSchema: JsonSchemaObject, isRequired: boolean) => {
758771const childPath = path ? `${path}.${key}` : key;
759772const resolvedHint = resolveUiHintMatch(uiHints, childPath);
773+const reloadMetadata = resolveReloadMetadata?.(childPath);
760774children.push({
761775 key,
762776path: childPath,
763777type: childSchema.type,
764778required: isRequired,
765779hasChildren: schemaHasChildren(childSchema),
780+reloadKind: reloadMetadata?.kind,
766781hint: resolvedHint?.hint,
767782hintPath: resolvedHint?.path,
768783});
@@ -788,6 +803,7 @@ function buildLookupChildren(
788803export function lookupConfigSchema(
789804response: ConfigSchemaResponse,
790805path: string,
806+resolveReloadMetadata?: ConfigSchemaReloadMetadataResolver,
791807): ConfigSchemaLookupResult | null {
792808const wantsRoot = path.trim() === ".";
793809const normalizedPath = normalizeLookupPath(path);
@@ -812,11 +828,18 @@ export function lookupConfigSchema(
812828}
813829814830const resolvedHint = resolveUiHintMatch(response.uiHints, normalizedPath);
831+const reloadMetadata = resolveReloadMetadata?.(normalizedPath);
815832return {
816833path: wantsRoot ? "." : normalizedPath,
817834schema: stripSchemaForLookup(current),
835+reloadKind: reloadMetadata?.kind,
818836hint: resolvedHint?.hint,
819837hintPath: resolvedHint?.path,
820-children: buildLookupChildren(current, wantsRoot ? "" : normalizedPath, response.uiHints),
838+children: buildLookupChildren(
839+current,
840+wantsRoot ? "" : normalizedPath,
841+response.uiHints,
842+resolveReloadMetadata,
843+),
821844};
822845}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。