Skip to content

fix(types): support fluent-json-schema - #244

Open
salluexez wants to merge 1 commit into
fastify:mainfrom
salluexez:fix/fluent-schema-types
Open

salluexez wants to merge 1 commit into
fastify:mainfrom
salluexez:fix/fluent-schema-types

Conversation

@salluexez

Copy link
Copy Markdown

Summary

Allow fluent-json-schema schemas to be passed to envSchema without TypeScript errors.

Problem

env-schema supports Fluent Schema objects at runtime and documents that usage, but EnvSchemaOpt.schema only accepted Ajv schema types. Consequently, valid Fluent Schema objects were rejected by TypeScript.

Solution

Add a dependency-free structural FluentSchema type and include it in the accepted schema union. This preserves existing Ajv and TypeBox support without adding a production or peer dependency.

Testing

  • npm run lint
  • npm test — 46 unit tests and 23 type assertions passed; 100% runtime coverage
  • npm pack --dry-run --cache /tmp/env-schema-npm-cache
  • git diff --check

Screenshots / Evidence

Not applicable; this is a TypeScript declaration fix.

Related Issue

Closes #138

Additional Notes

The regression test fails before the fix with TS2322 and passes afterward. There are no runtime changes or compatibility changes for existing schema types.

Signed-off-by: Mohd Salauddin <sallumalik1111@gmail.com>
Copilot AI lite review requested due to automatic review settings August 30, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Use with fluent-json-schema now requires to call valueOf in ObjectSchema when using Typescript

2 participants