@@ -170,21 +170,21 @@ func (v *Validator) CheckJSONSchema() (errs error) {
170170func (v * Validator ) CheckRoot () (errs error ) {
171171 logrus .Debugf ("check root" )
172172
173- if v .platform == "windows" && v . spec . Windows != nil {
174- if v .spec .Windows .HyperV != nil {
173+ if v .platform == "windows" {
174+ if v .spec .Windows != nil && v . spec . Windows .HyperV != nil {
175175 if v .spec .Root != nil {
176176 errs = multierror .Append (errs ,
177177 specerror .NewError (specerror .RootOnHyperVNotSet , fmt .Errorf ("for Hyper-V containers, Root must not be set" ), rspec .Version ))
178178 }
179179 return
180180 } else if v .spec .Root == nil {
181181 errs = multierror .Append (errs ,
182- specerror .NewError (specerror .RootOnWindowsRequired , fmt .Errorf ("on Windows, for Windows Server Containers, this field is REQUIRED" ), rspec .Version ))
182+ specerror .NewError (specerror .RootOnWindowsRequired , fmt .Errorf ("on Windows, for Windows Server Containers, Root is REQUIRED" ), rspec .Version ))
183183 return
184184 }
185- } else if v .platform != "windows" && v . spec .Root == nil {
185+ } else if v .spec .Root == nil {
186186 errs = multierror .Append (errs ,
187- specerror .NewError (specerror .RootOnNonWindowsRequired , fmt .Errorf ("on all other platforms, this field is REQUIRED" ), rspec .Version ))
187+ specerror .NewError (specerror .RootOnNonWindowsRequired , fmt .Errorf ("on all other platforms, Root is REQUIRED" ), rspec .Version ))
188188 return
189189 }
190190
0 commit comments