Skip to content

(fastapi / smithy) client-side form validation #329

@cogwirrel

Description

@cogwirrel

Description

Make it easier to validate inputs for FastAPI / Smithy APIs in client side forms.

Motivation

Backend validation is native to fastapi, but if you want to implement any form validation in the frontend you need to redefine your schemas or implement custom business logic.

Suggested Implementation

Generate a zod schema from openapi? While a form might not always map directly to an api input, generating zod for all the types in the api means either the whole structure or specific sub-structures could be validated against.

Zod can then be used for client side validation - could easily be integrated with something like tanstack form eg https://ui.shadcn.com/docs/forms/tanstack-form

Contribute to feature

  • I'd be willing to implement this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions