Skip to content

Zod: allOf doesn't work with type string #2340

@schrosis

Description

@schrosis

When type: string is used with allOf, allOf is ignored.

orval: 7.11.2
zod: 4.1.5

openapi: 3.1.0
info:
  title: example
  version: 0.0.1
paths:
  /example:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: string
              allOf:
                - $ref: '#/components/schemas/foo'
      responses:
        '204':
          description: No content
components:
  schemas:
    foo:
      type: string
      minLength: 1
      maxLength: 100
      description: 'Foo'

The output zod is this:

export const postExampleBody = zod.string()

allOf is ignored, and min, max, describe, and others are not generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    zodZod related issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions