Variable CaddyRouteMatcherSchemaConst
CaddyRouteMatcherSchema: ZodObject<
{
client_ip: ZodOptional<
ZodObject<
{ ranges: ZodOptional<ZodArray<ZodString, "many">> },
"strip",
ZodTypeAny,
{ ranges?: string[] },
{ ranges?: string[] },
>,
>;
expression: ZodOptional<ZodString>;
file: ZodOptional<
ZodObject<
{
fs: ZodOptional<ZodString>;
root: ZodOptional<ZodString>;
split_path: ZodOptional<ZodArray<ZodString, "many">>;
try_files: ZodOptional<ZodArray<ZodString, "many">>;
try_policy: ZodOptional<ZodString>;
},
"strip",
ZodTypeAny,
{
fs?: string;
root?: string;
split_path?: string[];
try_files?: string[];
try_policy?: string;
},
{
fs?: string;
root?: string;
split_path?: string[];
try_files?: string[];
try_policy?: string;
},
>,
>;
header: ZodOptional<ZodRecord<ZodString, ZodArray<ZodString, "many">>>;
header_regexp: ZodOptional<
ZodRecord<
ZodString,
ZodUnion<
[
ZodObject<
{ name: ZodOptional<ZodString>; pattern: ZodString },
"strip",
ZodTypeAny,
{ name?: string; pattern: string },
{ name?: string; pattern: string },
>,
ZodUndefined,
],
>,
>,
>;
host: ZodOptional<ZodArray<ZodString, "many">>;
method: ZodOptional<ZodArray<ZodString, "many">>;
not: ZodOptional<ZodArray<ZodRecord<ZodString, ZodUnknown>, "many">>;
path: ZodOptional<ZodArray<ZodString, "many">>;
path_regexp: ZodOptional<
ZodObject<
{ name: ZodOptional<ZodString>; pattern: ZodString },
"strip",
ZodTypeAny,
{ name?: string; pattern: string },
{ name?: string; pattern: string },
>,
>;
protocol: ZodOptional<ZodString>;
query: ZodOptional<ZodRecord<ZodString, ZodArray<ZodString, "many">>>;
remote_ip: ZodOptional<
ZodObject<
{ ranges: ZodOptional<ZodArray<ZodString, "many">> },
"strip",
ZodTypeAny,
{ ranges?: string[] },
{ ranges?: string[] },
>,
>;
tls: ZodOptional<
ZodObject<
{ handshake_complete: ZodOptional<ZodBoolean> },
"strip",
ZodTypeAny,
{ handshake_complete?: boolean },
{ handshake_complete?: boolean },
>,
>;
},
"strip",
ZodTypeAny,
{
client_ip?: { ranges?: string[] };
expression?: string;
file?: {
fs?: string;
root?: string;
split_path?: string[];
try_files?: string[];
try_policy?: string;
};
header?: Record<string, string[]>;
header_regexp?: Record<
string,
{ name?: string; pattern: string }
| undefined,
>;
host?: string[];
method?: string[];
not?: Record<string, unknown>[];
path?: string[];
path_regexp?: { name?: string; pattern: string };
protocol?: string;
query?: Record<string, string[]>;
remote_ip?: { ranges?: string[] };
tls?: { handshake_complete?: boolean };
},
{
client_ip?: { ranges?: string[] };
expression?: string;
file?: {
fs?: string;
root?: string;
split_path?: string[];
try_files?: string[];
try_policy?: string;
};
header?: Record<string, string[]>;
header_regexp?: Record<
string,
{ name?: string; pattern: string }
| undefined,
>;
host?: string[];
method?: string[];
not?: Record<string, unknown>[];
path?: string[];
path_regexp?: { name?: string; pattern: string };
protocol?: string;
query?: Record<string, string[]>;
remote_ip?: { ranges?: string[] };
tls?: { handshake_complete?: boolean };
},
> = ...
Caddy route matcher schema — covers every
http.matchers.*module exceptvars_regexp(internal Caddy variable matching).file(http.matchers.file) is generated incaddy-fileserver.tsrather thancaddy-http.ts— seematcher-schema-consistency.test.ts'sNON_MATCHER_HELPER_TYPES/scope note — but is composed here from the real generatedmatchFileSchema, same as the other matchers below.protocol,remote_ip,client_ip,header_regexp, andtlsare the real, correctly tygo-generatedmatchProtocolSchema/matchRemoteIpSchema/matchClientIpSchema/matchHeaderReSchema/matchTlsSchemafromcaddy-http.zod.ts— composed here, not duplicated by hand.not,expression, andpath_regexpare hand-overridden (not composed from the generatedmatchNotSchema/matchExpressionSchema/matchPathReSchema) because all three have custom JSON marshaling or anonymous Go struct embedding that tygo's naive extraction gets wrong — verified against real Caddy viacaddy validate, not just inferred from the generated struct shape:not(http.matchers.not, Go typeMatchNot) is an array of matcher sets (each an object keyed by matcher name); the generatedmatchNotSchemaisz.object({})(empty), reflecting Go's empty interface rather than the true custom-unmarshaled shape.expression(http.matchers.expression, Go typeMatchExpression) is a plain CEL string; the generatedmatchExpressionSchemaisz.object({ expr, name }), reflecting misleading Go struct fields — the doc comment explicitly says "this matcher's JSON interface is actually a string, not a struct".path_regexp(http.matchers.path_regexp, Go typeMatchPathRE) flattens to{ name?, pattern }directly; the generatedmatchPathReSchemawraps it as{ MatchRegexp: { name?, pattern } }— an anonymous-embedding artifact (same class of bug ascaddy-dns/route53's wrapper, seeDEPENDENCIES.md) — Caddy rejects the nested form withjson: unknown field "MatchRegexp". If any of these three Go types' custom marshaling/embedding ever changes, tygo/zod-to-json-schema won't catch it — re-verify withcaddy validatebefore trusting a regen here.