node-convict | Featureful configuration management library for Node.js | Configuration Management library
kandi X-RAY | node-convict Summary
kandi X-RAY | node-convict Summary
Featureful configuration management library for Node.js
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Normalizes a schema node .
- Validate an instance
- Flattens an object
- Coerce to schema .
- Parses provided path
- Get a JSON schema from a path
- get default format
- Overridden to overlay values .
- Import arguments from commander .
- Add default values to schema
node-convict Key Features
node-convict Examples and Code Snippets
Community Discussions
Trending Discussions on node-convict
QUESTION
I have following JSON config in a typescript
project. I would like to validate this on the front-end during run-time. I am looking for a solution similar to node-convict
.
I need to validate
- unique
id
/ No duplicate Id. - unique name.
- required property non empty
type
- Multiple children types conditionally e.g. if type ===
folder
they should havechildren
prop. it can be an empty array. - Nested Objects at multiple levels.
I've found AJV
. AJV docs only refer to whole object being unique not specific properties. I could potentially come up with my own and do some recursive validation. However, I am looking for most efficient solution whether using ajv, another library or an efficient data structure that I could use to validate this.
If using external library it need to be compatible with typescript. I am NOT looking for typescript compile-time validation.
...ANSWER
Answered 2020-Mar-14 at 23:48I'd recommend using the Joi data validation library. It has had browser support since version 16.
An example is as follows e.g.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-convict
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page