bradwestfall / bradwestfall/house-rules

Creating new schema with `undefined` rule should fail

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Consider this scenario:
```js
const schema = new Schema({ email: undefined })
```

This should IMHO fail or at least spit out a warning.

Now validating values against this schema returns an empyy object as if validation is passed.
```js
// output: {}
schema.validate({ email: 'aaaa' })
```

If creating new schema did not fail, this should certainly fail.

I don't mind working on this if there is interest and agreement how this should be handled.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the behavior at the Schema constructor and validate entry points shown in the issue. Clarify whether an undefined rule should be rejected during schema creation or validation, then add coverage for the agreed behavior and confirm that validating the example no longer silently returns an empty object.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.