On 02/06, David Lutterkort wrote: > > 2. Add ':required => true' parameter to attributes in the CIMI models and > > then add '.validate(format, body)' method and do all the validation on > > the model level. > > > > class MachineTemplate > > text :name, :required => true > > end > > > > What you think? Anyone have some better idea/thoughts? > > I think door #2 is the right answer - we want to keep the amount of work > we do on raw XML/JSON representations to a raw minimum.
Yes, I agree. Also for the validation I think we need to create 'MachineCreate' or 'MachineTemplateCreate' models, where we can defined what attributes are required and what not. As an additional benefit, later we will not need to do JSON.parse in the 'create_from_json' method and all we will need to do is: template = MachineTemplateCreate.from_json(body) (I sent patches to support this). -- Michal -- Michal Fojtik <mfoj...@redhat.com> Deltacloud API, CloudForms