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): array min max issues #1052

Merged
merged 2 commits into from
Nov 15, 2023
Merged

fix(zod): array min max issues #1052

merged 2 commits into from
Nov 15, 2023

Conversation

melloware
Copy link
Collaborator

Status

READY/WIP/HOLD

Description

Fix #933

This YAML

  /list:
    post:
      summary: Add list
      operationId: add-list
      responses:
        '200':
          description: OK
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                list:
                  type: array
                  minItems: 1
                  maxItems: 10
                  items:
                    type: number
                    minimum: 1
                    maximum: 10
              required:
                - list

gets generated properly as this

export const addListBodyListMax2 = 10;
export const addListBodyListMax1 = 10;


export const addListBody = zod.object({
  "list": zod.array(zod.number().min(1).max(addListBodyListMax1)).min(1).max(addListBodyListMax2)
})

@melloware melloware added the bug Something isn't working label Nov 14, 2023
Will-Mann-16
Will-Mann-16 previously approved these changes Nov 14, 2023
@melloware
Copy link
Collaborator Author

Looks like I have a merge conflict to resolve.

@melloware melloware linked an issue Nov 15, 2023 that may be closed by this pull request
@melloware melloware merged commit 5b29452 into orval-labs:master Nov 15, 2023
2 checks passed
@melloware melloware deleted the O933 branch November 15, 2023 20:40
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 client fails on array type Support minimum array length constraint
2 participants