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

RFC: Define discord type using schema library #2705

Open
H01001000 opened this issue Dec 29, 2022 · 1 comment
Open

RFC: Define discord type using schema library #2705

H01001000 opened this issue Dec 29, 2022 · 1 comment
Milestone

Comments

@H01001000
Copy link
Contributor

Current situation/status/issue:

  • Discord type are defined with interface
  • No way to validate types
  • Can't generate fake data with type

Propose:
Define discord type with schema library such as (ajv, zod, yup, etc), then generate type from it.

We can achieve:

  • Access type in normal js
  • Test against discord real data for validation
  • Generate mock/fake discord payload from schema
@H01001000 H01001000 changed the title RFF: Define discord type using schema library RFC: Define discord type using schema library Dec 29, 2022
@MatthewSH
Copy link
Contributor

MatthewSH commented Dec 4, 2023

I think having something like Zod could definitely open up opportunities to ensure safety specifically in our rest package. Right now we just use TypeScript to assume it's fine, we could have an optional setting that enables Zod (for example) validation that ensures the values are parsed.

I'd be totally on board with this and if it's done right we could make it a non-breaking change in v19. The amount of effort it would take would be huge though.

I'm completely for this and would love to see it move out of RFC.

@H01001000 H01001000 added this to the v19.5/20 milestone Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants