threefoldtecharchive / 0-robot

Distributed live cycle management system
Apache License 2.0
0 stars 0 forks source link

Support a special schema annotation to specify a reference to a service #26

Open rkhamis opened 6 years ago

rkhamis commented 6 years ago

Issue migrated from [https://api.github.com/repos/zero-os/0-robot/issues/103](), opened by @muhamadazmy

I know the title is not clear, i didn't know what to type in this limited size description. Let me explain.

Already in a lot of cases we want to define a filed in a template schema that reference to another service name, we work around this by setting it up to a Text filed and then validate that the service exists in the validate method.

May be we can have a better definition of this field by introducing a new type that can be imported from zrobot

Example:

using zrobot = import "zrobot.capnp";

struct Schema {
    account @1 :Text $zrobot.uid("github.com/org/templates/something/0.0.1");
}

I am using annotations to attach the exact template uid to the Template type.

Once a schema is defined this way, 0-robot can take extra step to validate that the given account is a valid name to a service of the given uid.

rkhamis commented 6 years ago

commented by @zaibon This is interesting. I'll see if we can access these annotation from the python capnp lib.