Fix validation by moving it into the resource builder.

Also always print an error for unknown field.
This commit is contained in:
Brendan Burns
2015-05-07 13:53:43 -07:00
parent 35c644a45f
commit 7f11585972
6 changed files with 57 additions and 11 deletions

View File

@@ -79,6 +79,7 @@ func RunCreate(f *cmdutil.Factory, out io.Writer, filenames util.StringList) err
mapper, typer := f.Object()
r := resource.NewBuilder(mapper, typer, f.ClientMapperForCommand()).
Schema(schema).
ContinueOnError().
NamespaceParam(cmdNamespace).RequireNamespace().
FilenameParam(filenames...).
@@ -95,9 +96,6 @@ func RunCreate(f *cmdutil.Factory, out io.Writer, filenames util.StringList) err
if err != nil {
return err
}
if err := schema.ValidateBytes(data); err != nil {
return err
}
obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, data)
if err != nil {
return err