Skip to content
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

Pass the config schema to adapters #23

Open
dirkluijk opened this issue Mar 11, 2025 · 1 comment
Open

Pass the config schema to adapters #23

dirkluijk opened this issue Mar 11, 2025 · 1 comment

Comments

@dirkluijk
Copy link

dirkluijk commented Mar 11, 2025

This allows adapters to transform the source object to match the schema, see #22.

For example:

type Adapter<T extends z.AnyZodObject = z.AnyZodObject> = {
  read: (schema: T) => Promise<z.infer<T>>;
  // ...
};

The benefit is that for a custom adapter, you won't need to pass the schema to it every time you create it.

Since adapters may as well ignore this argument, this would be a backwards compatible change.

@dirkluijk dirkluijk changed the title Allow adapters to access the schema Pass the config schema to adapters Mar 11, 2025
@dirkluijk
Copy link
Author

I opened this issue specifically for #22, but I suggest to first explore some directions in that issue. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant