hapijs / hapijs/joi

Make SchemaMap warn if missing keys

Open
#2,674 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
21.2k
Forks
1.5k
Avg merge
4h 57m
Merged PRs (30d)
14

Description

#### Support plan

* *is this issue currently blocking your project?* (yes/no): no
* *is this issue affecting a production system?* (yes/no): no

#### Context

* *node version*: v14.15.1
* *module version*: 17.1.1
* *environment* (e.g. node, browser, native): node
* *used with* (e.g. hapi application, another framework, standalone, ...): nestjs
* *any other relevant information*:

#### How can we help?

I'd like to know if there is a way to indicate with Joi that a validation schema is missing certain keys. The easiest way I can think of is through an example:

```js

interface Config {
readonly FOO: string
readonly BAR: string
}

// This should not compile, saying that the object passed in is missing property BAR
export const configValidationSchema = Joi.object({
FOO: Joi.string().required()
});
```

Apologies if this is a trivial question, still finding my bearings.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.