FirebaseExtended / bolt

Bolt Compiler (Firebase Security and Modeling)
Apache License 2.0
897 stars 107 forks source link

Generic type parsing issues #191

Open shawila opened 7 years ago

shawila commented 7 years ago

The following does not work:

type Creator<T> extends Timestamped<T> {
  createdBy: String
  updatedBy: String | Null
}

Error received:

$ bolt:1:1: Type contains properties and must extend 'Object'. (is Timestamped<User>)
$ bolt: Could not generate JSON: 1 errors.

Neither does:

type Creator<T> extends T {
  createdBy: String
  updatedBy: String | Null
}

path /interviews/{id} is Creator<Timestamped<Interview>> {} 

It would be helpful if either notation were possible. Currently, I'll have to remove the generic type notation and have my types extend Creator which in turn extends Timestamped.

One more thing that doesn't work, and that's related:

path /organisation_users/{organisationId} is Timestamped<User>[] {}

This isn't such a big deal, since it can be dealt with by just using subpath afaik.

path /organisation_users/{organisationId} is Any {
  path /{userId} is Timestamped<User> {}
}