orval icon indicating copy to clipboard operation
orval copied to clipboard

Bugs/typed tuple on zod

Open helt opened this issue 6 months ago • 5 comments

Status

DONE

Description

Support for typed tuples as they are produced by pydantic v2.0+

Reproduction for issue https://github.com/orval-labs/orval/issues/1592

  • in generateZodValidationSchemaDefinition, the array switch case has to be altered to adhere prefixItems constraints. If prefixItems exists,
    • [x] a tuple has to be pushed into functions instead of array,
    • [x] each prefixItem has to be parsed and nested into the tuple
    • [x] if items exists, a rest function has to be pushed after the tuple with the schema in items
  • in parseZodValidationSchemaDefinition:
    • [x] logic to add positional parameters to tuple
    • [x] logic for the rest functions has to be added
  • somewhere:
    • [x] prevent .min().max() on tuple.
  • [x] Tests added

helt avatar Aug 20 '24 12:08 helt