How to use the reach function from joi

Find comprehensive JavaScript joi.reach code examples handpicked from public code repositorys.

69
70
71
72
73
74
75
76
77
78
  })
} else {
  type = new GraphQLObjectType({
    name: typeName,
    description: desc.description,
    fields: () => descsToFields(mapValues(desc.children, (child, k) => Joi.reach(schema, k)))
  })
}
cachedTypes[typeName] = type
return type
fork icon9
star icon69
watch icon0

139
140
141
142
143
144
145
146
147
148

Get a sub-schema of an existing schema based on a `path` that can be either a string or an array of strings For string values path separator is a dot (`.`).

```js
const schema = Joi.object({ foo: Joi.object({ bar: Joi.number() }) });
const number = Joi.reach(schema, 'foo.bar');

//or
const result = Joi.reach(schema, ['foo', 'bar']); //same as number
```
fork icon0
star icon0
watch icon0

+ 3 other calls in file