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

Export createAdapter to make writing custom adapters easier #541

Open
magicalpuffin opened this issue Dec 26, 2024 · 1 comment
Open

Export createAdapter to make writing custom adapters easier #541

magicalpuffin opened this issue Dec 26, 2024 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@magicalpuffin
Copy link

Is your feature request related to a problem? Please describe.

I was having issues with the typebox adapter because the environment (cloudflare pages) doesn't allow type compiling. Trying to validate would result in a code generation error. To work around this, I wanted to use createAdapter and implement validate without compiling, however, it isn't exported. I ended up having to patch sveltekit-superforms/adapters/index.js.

async function validate<T extends TSchema>(

Describe the solution you'd like

Export createAdapter and other useful types to make it easier to implement custom adapters.

https://github.com/ciscoheat/sveltekit-superforms/blob/main/src/lib/adapters/index.ts

It would be nice to have a version of the typebox adapter without compiling, maybe a typeboxNoCompile. I do realize it might be niche, so exposing createAdapter with some documentation about writing adapters would be a more general solution.

@magicalpuffin magicalpuffin added the enhancement New feature or request label Dec 26, 2024
@ciscoheat
Copy link
Owner

Hello, thank you for the PR, the reason I'm hesitant is that as soon as something is exported, I have to support it and prevent breaking changes, and the createAdapter interface isn't set in stone. I was thinking about doing it in v3, so I'll add it to that milestone for the time being.

@ciscoheat ciscoheat added this to the v3 milestone Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants