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

fix[zod]: enable multiple properties of array consts #1051

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

sirtimbly
Copy link
Contributor

Status

READY

Description

This should fix #1027. The zod function that concatenated consts while parsing the properties of schemas was able to handle multiple properties (eg. min:2, max:5) only on objects, but not arrays. This code checks if there are multiple consts and concatenates them intelligently depending on it being either a single string or an array of strings.

Related PRs

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

> git pull --prune
> git checkout <branch>
> cd tests
> yarn run generate:zod
  1. Look at the file `tests/generated/zod/nestedArrays.ts
  2. The file should not contain any extra commas that cause a typescript parsing error.

@melloware melloware added this to the 6.21.0 milestone Nov 14, 2023
@melloware melloware added the bug Something isn't working label Nov 14, 2023
@melloware melloware merged commit 3ee382b into orval-labs:master Nov 14, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zod: schema with a file that contains minItems and maxItems in a two-dimensional array will result in an error
2 participants