carbon-io / carbond

MIT License
2 stars 5 forks source link

schema validation forces _id #210

Closed abdulito closed 7 years ago

abdulito commented 7 years ago

This is my schema

schema: {
    type: 'object',
    required: ["host", "signal"],
    additionalProperties: true,
    properties: {
      host: {type: 'string'},
      signal: {type: 'string'}
    }
  },

And i get the following error

Error: Error loading module: /Users/abdul/github/mlab/fleet-gateway/lib/endpoints/HostSignalsEndpoint.js Error: Invalid schema. _id must be a property, and must be required: {"type":"object","required":["host","signal"],"additionalProperties":true,"properties":{"host":{"type":"string"},"signal":{"type":"string"}}}
    at C._validate (/Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/carbond/lib/collections/Collection.js:214:13)
    at C._init (/Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/carbond/lib/collections/Collection.js:79:10)
    at Atom._initializeObject (/Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/atom/lib/atom.js:367:17)
    at Atom._makeObject (/Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/atom/lib/atom.js:157:12)
    at Atom.make (/Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/atom/lib/atom.js:117:24)
    at /Users/abdul/github/mlab/fleet-gateway/node_modules/@carbon-io/atom/lib/atom.js:775:19
    at Object.<anonymous> (/Users/abdul/github/mlab/fleet-gateway/lib/endpoints/HostSignalsEndpoint.js:8
abdulito commented 7 years ago

Working as design. Collections must have _id