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

Add public API introspection of the element schema for z.ZodSet #3501

Open
6XGate opened this issue May 18, 2024 · 2 comments
Open

Add public API introspection of the element schema for z.ZodSet #3501

6XGate opened this issue May 18, 2024 · 2 comments

Comments

@6XGate
Copy link

6XGate commented May 18, 2024

Currently, z.ZodSet lacks any public API to access the schema of the set elements. I'm not sure if any is an oversight, but it would be a great addition.

Currently z.ZodArray, z.ZodRecord, and z.ZodMap all support such features. Doesn't seem to be too great an ask for a similar feature for z.ZodSet.

@samchungy
Copy link
Contributor

You can access zodSet._def.valueType?

@6XGate
Copy link
Author

6XGate commented May 23, 2024

The underscore would indicate that _def is not intended for public consumption and could change in the future. It would be preferred to have something that does not fall under that semantic situation.

6XGate added a commit to 6XGate/zod that referenced this issue May 24, 2024
6XGate added a commit to 6XGate/zod that referenced this issue May 24, 2024
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