brikteknologier / seraph-model

thin model layer for seraph/neo4j (node.js)
MIT License
111 stars 28 forks source link

How to do nested object schema? #129

Closed booboothefool closed 7 years ago

booboothefool commented 7 years ago

Like so:

{
    local            : {
        email        : String,
        password     : String,
    },
    facebook         : {
        id           : String,
        token        : String,
        email        : String,
        name         : String
    },
    twitter          : {
        id           : String,
        token        : String,
        displayName  : String,
        username     : String
    },
    google           : {
        id           : String,
        token        : String,
        email        : String,
        name         : String
    }
}

Didn't see this mentioned at: https://github.com/brikteknologier/seraph-model#schema.type

I tried:

  local: {
    email: { type: String },
    password: { type: String },
  },

but get Error: Invalid schema key.

jonpacker commented 7 years ago

Hi! Nested objects aren't actually supported by Neo4j, so they're not supported by the schema feature either. The closest you could come would be to create several models and use the model composition feature to compose them.