-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Labels
Description
Hello,
I'm trying to create a multi-level heirarchy of resources, but am unable to get it to work beyond two top level resources. Below is the schema definition:
var Foundation = schema.Schema{
Description: "Schema describing foundation",
Fields: schema.Fields{
"id": schema.IDField,
"name": {
Required: true,
Filterable: true,
Sortable: true,
Validator: &schema.String{},
},
},
}
var Org = schema.Schema{
Description: "Schema describing Org",
Fields: schema.Fields{
"id": schema.IDField,
"name": {
Required: true,
Filterable: true,
Sortable: true,
Validator: &schema.String{},
},
"foundation": {
Required: true,
Filterable: true,
Sortable: true,
Validator: &schema.Reference{
Path: "foundations",
},
},
},
}
var Space = schema.Schema{
Description: "Schema describing Space",
Fields: schema.Fields{
"id": schema.IDField,
"name": {
Required: true,
Filterable: true,
Sortable: true,
Validator: &schema.String{},
},
"org": {
Required: true,
Filterable: true,
Sortable: true,
Validator: &schema.Reference{
Path: "orgs",
},
},
},
}
And the corresponding binding:
foundations := index.Bind("foundations", fractal_schema.Foundation, mem.NewHandler(), resource.Conf{
AllowedModes: resource.ReadWrite,
})
orgs := foundations.Bind("orgs", "foundation", fractal_schema.Org, mem.NewHandler(), resource.Conf{
AllowedModes: resource.ReadWrite,
})
spaces := orgs.Bind("spaces", "org", fractal_schema.Space, mem.NewHandler(), resource.Conf{
AllowedModes: resource.ReadWrite,
})
This gives me the following error:
{"time":"2017-09-28T14:59:34+05:30","level":"fatal","message":"Invalid API configuration: foundations.orgs.spaces: schema compilation error: org: can't find resource 'orgs'"}
exit status 1
Any tips would be helpful.
Thanks