Skip to content

Feature/enum support - #2

Merged
yasserfedsi merged 2 commits into
mainfrom
feature/enum-support
Jun 15, 2026
Merged

Feature/enum support#2
yasserfedsi merged 2 commits into
mainfrom
feature/enum-support

Conversation

@yasserfedsi

@yasserfedsi yasserfedsi commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Pull request overview

Adds enum validation support to validateEnv, allowing schema entries to specify a set of allowed string values (e.g., NODE_ENV: ["development", "production", "test"]) and validating process.env against that set.

Changes:

  • Extend the Schema type to support enum rules (readonly string[]) and route those rules through a new parseEnum validator.
  • Add Vitest coverage for valid/invalid enum values and ensure NODE_ENV is cleaned up between tests.
  • Export EnumType and bump package version to 0.2.0.

@yasserfedsi
yasserfedsi requested a review from Copilot June 15, 2026 19:12
@yasserfedsi yasserfedsi self-assigned this Jun 15, 2026
@yasserfedsi yasserfedsi added the enhancement New feature or request label Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds enum validation support to validateEnv, allowing schema entries to specify a set of allowed string values (e.g., NODE_ENV: ["development", "production", "test"]) and validating process.env against that set.

Changes:

  • Extend the Schema type to support enum rules (readonly string[]) and route those rules through a new parseEnum validator.
  • Add Vitest coverage for valid/invalid enum values and ensure NODE_ENV is cleaned up between tests.
  • Export EnumType and bump package version to 0.2.0.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/validate.test.ts Adds tests for enum validation and invalid enum error behavior; cleans up NODE_ENV in beforeEach.
src/validators.ts Introduces parseEnum to validate env var values against an allowed set.
src/validateEnv.ts Extends schema handling to support enum rules via Array.isArray(rule) and parseEnum.
src/index.ts Re-exports EnumType from the public API.
package.json Bumps package version to 0.2.0.
package-lock.json Updates lockfile version metadata to 0.2.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yasserfedsi

Copy link
Copy Markdown
Collaborator Author

good

@yasserfedsi
yasserfedsi merged commit 05e525a into main Jun 15, 2026
2 checks passed
@yasserfedsi
yasserfedsi deleted the feature/enum-support branch June 15, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants