@@ -51,20 +51,6 @@ func ValidateWMS(wms *WMS, warnings *[]string, allErrs *field.ErrorList) {
5151 wms .GetName (),
5252 )
5353 }
54- } else {
55- styleFile := false
56- for _ , key := range wms .Spec .Service .StylingAssets .GetAllConfigMapRefKeys () {
57- if strings .HasSuffix (key , ".style" ) {
58- styleFile = true
59- break
60- }
61- }
62- if ! styleFile {
63- * allErrs = append (* allErrs , field .Required (
64- field .NewPath ("spec" ).Child ("service" ).Child ("stylingAssets[*]" ).Child ("configMapRefs[*]" ).Child ("keys" ),
65- "at least one .style file is required" ,
66- ))
67- }
6854 }
6955
7056 ValidateInspire (wms , allErrs )
@@ -129,7 +115,9 @@ func validateLayer(layer AnnotatedLayer, path *field.Path, groupStyles []string,
129115 validateLayerWithMapfile (layer , path , wms , warnings , allErrs )
130116
131117 if layer .Visible {
132- * hasVisibleLayer = true
118+ if ! layer .IsTopLayer {
119+ * hasVisibleLayer = true
120+ }
133121 } else {
134122 validateNotVisibleLayer (layer , path , wms , warnings , allErrs )
135123 }
@@ -150,9 +138,6 @@ func validateLayer(layer AnnotatedLayer, path *field.Path, groupStyles []string,
150138 ))
151139 }
152140 }
153- if tif := layer .Data .TIF ; tif != nil {
154- tifWarnings (tif , path , wms , warnings )
155- }
156141 }
157142
158143 for i , subLayer := range layer .Layers {
@@ -180,12 +165,19 @@ func validateLayerWithMapfile(layer AnnotatedLayer, path *field.Path, wms *WMS,
180165 wms .GetName (),
181166 )
182167 }
183- if ! hasCustomMapfile && service .DataEPSG != "EPSG:28992" && ! layer .hasBoundingBoxForCRS (service .DataEPSG ) {
168+ if ! hasCustomMapfile && service .DataEPSG != "EPSG:28992" && ! layer .hasBoundingBoxForCRS (service .DataEPSG ) && layer . Name != nil {
184169 * allErrs = append (* allErrs , field .Required (
185170 path .Child ("boundingBoxes" ).Child ("crs" ),
186171 fmt .Sprintf ("must contain a boundingBox for CRS %s when service.dataEPSG is not 'EPSG:28992'" , service .DataEPSG ),
187172 ))
188173 }
174+
175+ if layer .IsDataLayer && hasCustomMapfile {
176+ if tif := layer .Data .TIF ; tif != nil {
177+ tifWarnings (tif , path , wms , warnings )
178+ }
179+ }
180+
189181}
190182
191183func tifWarnings (tif * TIF , path * field.Path , wms * WMS , warnings * []string ) {
@@ -241,7 +233,7 @@ func validateStyle(style Style, path *field.Path, styleNames *[]string, groupSty
241233 if layer .IsGroupLayer {
242234 if slices .Contains (* groupStyles , style .Name ) {
243235 * allErrs = append (* allErrs , field .Invalid (
244- path ,
236+ path . Child ( "name" ) ,
245237 style .Name ,
246238 "A GroupLayer can't redefine the same style as a parent layer" ,
247239 ))
0 commit comments