Skip to content

Comments

feat(zod)!: drop YAML files support#24

Merged
vabatta merged 2 commits intoproventuslabs:mainfrom
Ostrzy:feat/zod-drop-yaml-files-support
Oct 10, 2025
Merged

feat(zod)!: drop YAML files support#24
vabatta merged 2 commits intoproventuslabs:mainfrom
Ostrzy:feat/zod-drop-yaml-files-support

Conversation

@Ostrzy
Copy link
Contributor

@Ostrzy Ostrzy commented Oct 10, 2025

📋 Description

This PR drops support for YAML files as per @vabatta request, while also removing feature related to them that is JSON parsing values in ENV variables.

The main reason for this change was an edge we've encountered with ENV variables that is string ID consisting of only numbers. When such ID get longs enough, we're getting a number that is bigger than Number.MAX_SAFE_INTEGER, so its value gets altered when parsed as number by JSON.parse.
Example: ENV variable PROJECT_ID="347532342342349855" is turned into number 347532342342349800.

📝 Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation and CI/CD

🚨 Breaking Changes

  • Dropped support for YAML configuration files
  • ENV variables are no longer parsed as JSON values

Migration Guide

  • If you were using YAML configuration files, there's no longer support for them and you have to handle them yourself
  • If you were using JSON objects in ENV variables, there's no longer direct support for them and you need to parse them yourself, possibly using zod.transform
  • If you relied on numbers / booleans / etc. being parsed by the library, you need to alter your schemas to use z.coerce, so port: z.number().default(5432), turns into port: z.coerce.number().default(5432),

It caused problems in case when there was a string identifier consisting
only of numbers e.g.: `PROJECT_ID="347532342342349855"`. Such env parsed
as JSON value resulted in a number, but JS numbers can't represent
numbers that big so the resulting value would be 347532342342349800.
@Ostrzy Ostrzy force-pushed the feat/zod-drop-yaml-files-support branch from 7b43489 to bd50b4d Compare October 10, 2025 09:38
Copy link
Contributor

@vabatta vabatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE

@vabatta vabatta merged commit 1023c42 into proventuslabs:main Oct 10, 2025
5 checks passed
vabatta pushed a commit that referenced this pull request Oct 10, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.0.0](https://github.com/proventuslabs/nestjs/compare/nestjs-zod@v1.2.0...nestjs-zod@v2.0.0)
(2025-10-10)


### ⚠ BREAKING CHANGES

* **zod:** ENV variables are no longer parsed as JSON values and dropped
support for YAML configuration files

### Features

* **zod:** drop YAML files support
([#24](#24))
([1023c42](1023c42))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants