Ignore empty objects from streams and error when nothing passed to create

Passing zero objects to create should be an error
This commit is contained in:
Clayton Coleman
2015-01-14 13:06:53 -05:00
parent 31413c8727
commit ccdc20d90c
3 changed files with 15 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package resource
import (
"bytes"
"fmt"
"io"
"io/ioutil"
@@ -356,6 +357,10 @@ func (v *StreamVisitor) Visit(fn VisitorFunc) error {
}
return err
}
ext.RawJSON = bytes.TrimSpace(ext.RawJSON)
if len(ext.RawJSON) == 0 || bytes.Equal(ext.RawJSON, []byte("null")) {
continue
}
info, err := v.InfoForData(ext.RawJSON, v.Source)
if err != nil {
if v.IgnoreErrors {