Skip to content

Extended configurations do not respect skipValidation #323

@oswaldoacauan

Description

@oswaldoacauan

I would expect that when extending a preset it would respect the skipValidation flag of where it was extended, instead it only follows the preset skipValidation configuration.

// packages/auth/env.ts
import { createEnv } from "@t3-oss/env-core";
export const env = () => createEnv({
  // no skipValidation set
});
 
// apps/web/env.ts
import { createEnv } from "@t3-oss/env-nextjs";
import { env as authEnv } from "@repo/auth/env";
 
export const env = createEnv({
  // ...
  extends: [authEnv()],
  skipValidation: !!process.env.SKIP_ENV_VALIDATION,
});

For the code above I would expect that if SKIP_ENV_VALIDATION=true all validations will be skipped, but thats not the case, the validations for /packages/auth/env.ts will still run.

To fix it, I need to replicate the skipValidation: !!process.env.SKIP_ENV_VALIDATION, on each of my presets.

Demo: https://codesandbox.io/p/devbox/7jhxrg

Is this the expected behaviour? It probably should be mentioned at least somewhere in the docs that presets are fully independent configurations and that they run in a standalone mode regardless of the options of where they were extended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions