Skip to content

feat(figue): integrate @standard-schema/spec to replace zod #9

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CorentinTh
Copy link
Owner

@CorentinTh CorentinTh commented Apr 2, 2025

Closes #5

@CorentinTh CorentinTh requested a review from Copilot April 2, 2025 16:52
@CorentinTh CorentinTh self-assigned this Apr 2, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates the @standard-schema/spec library to replace Zod in configuration validation. Key changes include updating type definitions in figue.types.ts, replacing the buildConfigSchema function with a new synchronous validateConfig implementation in figue.ts, and modifying tests in figue.test.ts to support multiple validation libraries.

Reviewed Changes

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

Show a summary per file
File Description
src/index.ts Removed the export for buildConfigSchema and now only exports defineConfig.
src/figue.types.ts Updated type definitions to use StandardSchemaV1 and its InferOutput method.
src/figue.ts Replaced buildConfigSchema with validateConfig and adjusted the configuration merging logic.
src/figue.test.ts Added a test case to ensure support for multiple validation libraries (e.g., Zod and Valibot).
src/figue.errors.ts Updated error creation to use StandardSchemaV1.Issue instead of ZodIssue.
Files not reviewed (2)
  • package.json: Language not supported
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

src/figue.ts:58

  • The current check in isConfigDefinitionElement strictly requires a '~standard' property, which may break integration with alternative validation libraries (such as valibot) expected in the tests. Consider refactoring this check to support a polymorphic approach for schema validation.
&& '~standard' in config.schema

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.

[FEAT] Use Stanrard Schema interface to support other validation libs
1 participant