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): pass resolved specKey in context #1789

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

FEgor04
Copy link
Contributor

@FEgor04 FEgor04 commented Jan 7, 2025

Status

READY

Description

This PR adds a new entry to tests/configs/zod.config.ts that shows a bug for $ref objects and fixes it

If we reference a schema in subdirectory, it works at least for React Query and Fetch, however it fails for Zod.

UPD: The solution to the bug is to get specKey key from resolved schema and use it to resolve its fields

@melloware melloware added the zod Zod related issue label Jan 7, 2025
@FEgor04 FEgor04 force-pushed the import-from-subdirectory branch 2 times, most recently from 386b28d to 472d111 Compare January 8, 2025 07:24
@FEgor04 FEgor04 changed the title tests(import-from-subdirectory): zod regression test case fix(zod): pass resolved specKey in context Jan 8, 2025
@FEgor04 FEgor04 force-pushed the import-from-subdirectory branch from 472d111 to 37c9f50 Compare January 8, 2025 07:33
@melloware melloware added this to the 7.4.1 milestone Jan 8, 2025
Add a new file to `import-from-subdirectory/subdirectory`, reference
this file in `petstore.yaml`.

Codegen for this schema works for at least React Query,
but for zod it throws an error:
```
🛑 importFromSubdirectory - Oops... 🍻. Ref not found: another-file.yaml#/components/schemas/AnotherSchema
```
@FEgor04 FEgor04 force-pushed the import-from-subdirectory branch from 37c9f50 to 8362f08 Compare January 8, 2025 12:21
@melloware melloware merged commit 813916e into orval-labs:master Jan 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zod Zod related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants