Skip to content

Consider using a type-validation library? #380

@apricot13

Description

@apricot13

In the DPR backend we've been experimenting with Typebox through Elysia's deep integration with it.

I've made a start at converting the current schema to Typebox, albeit mostly automated using ts2typebox.

You can see how we've been using it in our backend tools here

Theres a scalar and swagger instance being generated from these files as well (slowly unfortunately at the moment!) and I've included those in that branch.

The main issue has been the fact that the main types are unions so the validation can get scary! Its the same issue with plain typescript as well when you're creating 'generic' applications eg

const application: PostSubmissionPublishedApplication = {}

I can see some pros and cons for adding another layer but wanted to put it here for a suggestion. (The automated generation of openAPI files gets a +1 from me for sure though!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions