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

Q: Object with random key:value validation #302

Open
dougg0k opened this issue Aug 4, 2022 · 2 comments
Open

Q: Object with random key:value validation #302

dougg0k opened this issue Aug 4, 2022 · 2 comments

Comments

@dougg0k
Copy link

dougg0k commented Aug 4, 2022

Hi,

In the validation here, I have the validation below for, since there are random key:value, that can be put on.

data: {
	type: "object",
	empty: true,
},

What I want to ask, is there a way to validate the value type in these random (key:value)?

Like have the random values only be type string | number | boolean.

e.g., in typescript { data: Record<string, string | number | boolean>; }

@icebob
Copy link
Owner

icebob commented Aug 13, 2022

Maybe it will be a solution? #276

@dougg0k
Copy link
Author

dougg0k commented Aug 13, 2022

It seems it's only making a way to expect the key to be one or the other, though if they support the multi validation type for the value, it could work.

I have a object with random data, that data is key string and value can be string, number, boolean, object or even an array. That's what I am looking to validate, have the options to set what kind of random values it can be expect in that object, in their random keys.

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