Closed JarvisH closed 1 year ago
When an optional string schema is processed, the builtInValidationMethod exits early via return.
builtInValidationMethod
The loop should not exit early but continue via continue.
continue
This bug currently breaks all validation of schemas with an optional value.
function builtinValidation(env, schema) { const errors = []; for (const [key, validator] of Object.entries(schema)) { try { const res = validator(key, env[key]); if (typeof res === "undefined") { delete process.env[key]; return; // should be continue; } process.env[key] = res; } catch (err) { errors.push({ key, err }); } } if (errors.length) { throw new Error(errorReporter$1(errors)); } }
Ooops,was introduced with #9 . I didn't catch this
Released fix with 0.2.4. Thanks for the issue !
When an optional string schema is processed, the
builtInValidationMethod
exits early via return.The loop should not exit early but continue via
continue
.This bug currently breaks all validation of schemas with an optional value.