style(setup): format retained field validation
This commit is contained in:
@@ -36,7 +36,8 @@ export const registrationFieldAccepted = (
|
||||
key: string,
|
||||
value: unknown,
|
||||
): boolean => {
|
||||
const shape: Readonly<Record<string, z.ZodType>> = registrationSchemaFor(dialect).shape;
|
||||
const shape: Readonly<Record<string, z.ZodType>> =
|
||||
registrationSchemaFor(dialect).shape;
|
||||
const field = Object.hasOwn(shape, key) ? shape[key] : undefined;
|
||||
return field === undefined || field.safeParse(value).success;
|
||||
};
|
||||
|
||||
@@ -14,7 +14,10 @@ import { resolve } from "node:path";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import { registrationSchema, registrationSchemaFor } from "./ClientRegistrationShape.js";
|
||||
import {
|
||||
registrationSchema,
|
||||
registrationSchemaFor,
|
||||
} from "./ClientRegistrationShape.js";
|
||||
import { PRODUCT_IDENTITY } from "../identity.js";
|
||||
import { MCP_STARTUP_POLICY } from "../mcpStartupPolicy.js";
|
||||
import {
|
||||
@@ -322,7 +325,9 @@ const parseRegistration = (
|
||||
args,
|
||||
});
|
||||
}
|
||||
const registration = registrationSchemaFor(client.format ?? "json").parse(value);
|
||||
const registration = registrationSchemaFor(client.format ?? "json").parse(
|
||||
value,
|
||||
);
|
||||
if (
|
||||
(client.format === "vscode" || client.format === "copilot_cli") &&
|
||||
registration.type !== "stdio"
|
||||
|
||||
@@ -476,7 +476,6 @@ export const inspectClientConfiguration = async (
|
||||
"The existing configuration is malformed. Repair it before setup applies any other changes.",
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const clientRegistrationDialect = (
|
||||
|
||||
Reference in New Issue
Block a user