FirebaseExtended / bolt

Bolt Compiler (Firebase Security and Modeling)
Apache License 2.0
896 stars 108 forks source link

extending Null ignores additional validation rules #238

Open ex37 opened 5 years ago

ex37 commented 5 years ago

As long as I mainly use optional types, to be able to update individual properties, instead of passing whole object, I want to create an optional type, so instead of writing:

type User {
  id: String | Null;
  active: Boolean | Null;
  ....
}

I can do smth like:

type User {
  id: Str;
  active: Bool;
}
type Str extends Null {
  validate() { this.isString() }
}

When doing so, following is generated:

"id": {
  ".validate": "false"
},

In addition, would be nice to have ability to implement something like O<T>, i.e. O<String>, O<Boolean>