klum-dsl / klum-ast

Turn your models into super models
https://github.com/klum-dsl/klum-ast/wiki
MIT License
3 stars 0 forks source link

OwnerName field #211

Closed pauxus closed 4 years ago

pauxus commented 4 years ago

Similar to @Owner, provide an annotation that provides the name of the field in the owner containing this field. Example:

@DSL class Service {
  User readOnly
  User admin
}

@DSL class User {
  @Owner service
  @OwnerName role
  @Key name
}

def service = Service.create {
  readOnly("User")
  admin("superuser")
}

assert service.admin.role == "admin"
assert service.readOnly.role == "readOnly"

This could also be name @Role which would be more in accordance to UML

pauxus commented 4 years ago

Duplicate of #86