-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Description
Overview
Users should be able to define DGraph schema in object format. Defining schema in an object format will enable us to provide more validations to the schema in a clearer way like validation for each predicate, e.g.
UserSchema = new DgraphSchema({
username: {
type: 'String',
index: true,
immutable: true
},
password: {
type: 'Password',
min: 6,
max: 26
},
})Motivation
A big motivation for such a feature comes from the package mongoose which a MongoDB client for javascript.
Action Items
- Support
DgraphSchemain an object format - Provide basic validation options such as:
-
immutable: [true | false] -
min: [int]andmax: [int] -
unique: [true | false] -
required: [true | false] -
match: [new RegExp()] -
default: [any]// default value for the predicate -
lowercase: [true | false]// change the string to lowercase before saving into the DB -
uppercase: [true | false]// change the string to uppercase before saving into the DB
-
- return formatted error if provided data fails against the schema
Metadata
Metadata
Assignees
Labels
No labels