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

Compatibility with standard-schema #14539

Open
1 task done
BrunnerLivio opened this issue Jan 30, 2025 · 3 comments
Open
1 task done

Compatibility with standard-schema #14539

BrunnerLivio opened this issue Jan 30, 2025 · 3 comments

Comments

@BrunnerLivio
Copy link
Member

BrunnerLivio commented Jan 30, 2025

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

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

There are numerous schema validators out there. This has spawned an ecosystem around NestJS with various integrations such as nestjs-valibot and many others.

Describe the solution you'd like

NestJS could support stanadard-schema which recently hit 1.0.0:

Standard Schema is a common interface designed to be implemented by JavaScript and TypeScript schema libraries.

With that a commonly shared ValidationPipe could be offered directly from the framework instead of copy/pasting the integrations from the docs site.

Teachability, documentation, adoption, migration strategy

Guide on how to accept Standard Schema: https://standardschema.dev/#how-do-i-accept-standard-schemas-in-my-library

  • Offer a general ValidationPipe that is compatible with standard-schema
  • Update the docs how the ValidationPipe can be utilised with different schema libraries

What is the motivation / use case for changing the behavior?

I think it makes NestJS more future-proof with any future schema/validation library that might come

@BrunnerLivio BrunnerLivio added needs triage This issue has not been looked into type: enhancement 🐺 labels Jan 30, 2025
@BrunnerLivio
Copy link
Member Author

Notably, there is an issue open on class-validator side around this topic as well:
typestack/class-validator#2577

@micalevisk
Copy link
Member

I like the ideia but I think this should start as a 3rd-party lib to see community's adoption

@kamilmysliwiec
Copy link
Member

I guess there's nothing we can do until class-validator supports the standard schema too (to avoid breaking changes)

@micalevisk micalevisk removed the needs triage This issue has not been looked into label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants