Giter Site home page Giter Site logo

Comments (5)

ciscoheat avatar ciscoheat commented on June 15, 2024 2

The adapter is quite central to superValidate, so it'll take a bit of work, also to figure out defaults, so it'll have to be a future feature.

from sveltekit-superforms.

mpost avatar mpost commented on June 15, 2024 1

Creating an empty zod object via superValidate(request, zod(z.object({}))) does work. It would be nice however, to not having to rely on a specific validator implementation to create a dummy validator. Eg.: superValidate(request).

from sveltekit-superforms.

ciscoheat avatar ciscoheat commented on June 15, 2024

You can use an empty object schema, or check this example: https://stackblitz.com/edit/sveltekit-superforms-list-actions

from sveltekit-superforms.

mpost avatar mpost commented on June 15, 2024

Thanks for your answer. This is an interesting example. It has similar requirements to my use-case.

An observation: The "delete" buttons carry the value of the id has defined in the schema. However, that is not required, since in the +page.server.ts the line 28 could be exchanged for the following, using the form id instead of the schema id.

const index = constellations.findIndex((s) => s.id.toString() == form.id);

This would render the schema itself not required.

Could you give an example on how to create an empty superValidate/superForm? I found that a ValidationAdapter is required and there is no adapter which accepts an "empty" object or something similar to z.unkown() (when using zod). Thanks.

from sveltekit-superforms.

ciscoheat avatar ciscoheat commented on June 15, 2024

Doesn't z.object({}) work?

from sveltekit-superforms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.