resources: Specify defaults for the MetaParams
When creating new resources, we didn't specify the defaults, which for the limit metaparam caused invalid resources by default. It would be nice to change the limit param to have the 1/X (reciprocal) as the default, although the problem with that is that (1) it is illogical, and (2) it's not clear if the precision for the common cases is enough. If someone wants to investigate this further, please do! Zero value structs are definitely more useful! In any case, we can now specify the default. It's not entirely obvious to me if this is the best way to do it, or if there is a superior method.
This commit is contained in:
@@ -213,7 +213,7 @@ type BaseRes struct {
|
||||
|
||||
// UnmarshalYAML is the custom unmarshal handler for the BaseRes struct. It is
|
||||
// primarily useful for setting the defaults, in particular if meta is absent!
|
||||
// FIXME: uncommenting this seems to block the graph from exiting, how come???
|
||||
// FIXME: how come we can't get this to work properly without dropping fields?
|
||||
//func (obj *BaseRes) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
// DefaultBaseRes := BaseRes{
|
||||
// // without specifying a default here, if we don't specify *any*
|
||||
@@ -222,7 +222,7 @@ type BaseRes struct {
|
||||
// MetaParams: DefaultMetaParams, // force a default
|
||||
// }
|
||||
|
||||
// type rawBaseRes BaseRes // indirection to avoid infinite recursion
|
||||
// type rawBaseRes BaseRes // indirection to avoid infinite recursion
|
||||
// raw := rawBaseRes(DefaultBaseRes) // convert; the defaults go here
|
||||
// //raw := rawBaseRes{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user