sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
52 stars 2 forks source link

Allow `enum` field type be a type #187

Open robcxyz opened 10 months ago

robcxyz commented 10 months ago

Similar to rust's enums, we should allow enum fields be a type. For instance:

MyType<-: 
  foo: str 

MyHook<-: 
  my_field: 
    type: true 
    enum: 
      - str 
      - MyType 
call_str->: MyHook --my_field foo 
call_type->: MyHook --my_field {'foo': 'bar'} 

Here we can see that the enum can be either a string or of type MyType. This would be useful to have when a hook needs to have a field be one of a special type.

Relates to #185