masumsoft / express-cassandra

Cassandra ORM/ODM/OGM for NodeJS with support for Apache Cassandra, ScyllaDB, Datastax Enterprise, Elassandra & JanusGraph.
http://express-cassandra.readthedocs.io
GNU Lesser General Public License v3.0
227 stars 67 forks source link

Validators in UDTs #189

Open Cleomir opened 5 years ago

Cleomir commented 5 years ago

Hello, I'm trying to define the following UDT:

udts: { address: { street: 'text', city: 'text', postal: 'text', state: 'text', country: 'text', address_type: { type: 'text' rule: { validator(value: string) { return value === 'residential' || value === 'commercial'; } } }, } }

And I'm getting the following error: apollo.model.save.dberror: Error during save query on DB -> ResponseError: line 1:120 no viable alternative at input '[' (..."state" text,"country" text,"address_type" [[]...)

It's not clear in the documentation if it's possible to define validators inside UDTs or if it's a bug.