-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Circular dependencies? #118
Comments
This happens to me as well after upgrading to version 3.23.5 of ZOD Circular dependency: node_modules/zod-to-json-schema/dist/esm/parseDef.js -> node_modules/zod-to-json-schema/dist/esm/parsers/array.js -> node_modules/zod-to-json-schema/dist/esm/parseDef.js |
Thanks for opening an issue. Is this an actual problem? |
more of an unconformity since it apparently does not break the app, just nasty logs at build |
Seems like a duplicate of #113 We're seeing this issue with |
Also, this doesn't seem like a hard fix either.
The first import is a type and the second import could be made into an argument of the function to break the cycle. That's probably the least invasive way import { ZodDefaultDef } from "zod";
import type { JsonSchema7Type, ParseDefFunc } from "../parseDef.js";
import { Refs } from "../Refs.js";
export function parseDefaultDef(
_def: ZodDefaultDef,
refs: Refs,
parseDef: ParseDefFunc,
): JsonSchema7Type & { default: any } {
return {
...parseDef(_def.innerType._def, refs),
default: _def.defaultValue(),
};
} There are other ways to break cycles but this seems to require the least amount of rework to the code |
I'm hesitant to change the structure of the code to accommodate weird bundler behavior when there's nothing wrong with it.
Maybe there are some log level settings you can try? Not closing the issue, mind. It's just not super high on the list of priorities ATM. :) |
i get many circular dependencies from zod-to-json-schema when building with rollup
see image:
The text was updated successfully, but these errors were encountered: