@@ -26,6 +26,7 @@ package v2beta1
2626
2727import (
2828 "log"
29+ "strconv"
2930
3031 pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
3132 smoothoperatormodel "github.com/pdok/smooth-operator/model"
@@ -43,7 +44,7 @@ func (src *WFS) ConvertTo(dstRaw conversion.Hub) error {
4344 return src .ToV3 (dst )
4445}
4546
46- //nolint:gosec,funlen
47+ //nolint:gosec,funlen,cyclop
4748func (src * WFS ) ToV3 (dst * pdoknlv3.WFS ) error {
4849 dst .ObjectMeta = src .ObjectMeta
4950
@@ -87,6 +88,9 @@ func (src *WFS) ToV3(dst *pdoknlv3.WFS) error {
8788 }
8889 }
8990
91+ if err != nil {
92+ return err
93+ }
9094 service := pdoknlv3.WFSService {
9195 Prefix : src .Spec .General .Dataset ,
9296 URL : * url ,
@@ -106,10 +110,17 @@ func (src *WFS) ToV3(dst *pdoknlv3.WFS) error {
106110 "EPSG::4258" ,
107111 "EPSG::4326" ,
108112 },
109- CountDefault : src .Spec .Service .Maxfeatures ,
110113 FeatureTypes : make ([]pdoknlv3.FeatureType , 0 ),
111114 }
112115
116+ if src .Spec .Service .Maxfeatures != nil {
117+ maxFeatures , err := strconv .Atoi (* src .Spec .Service .Maxfeatures )
118+ if err != nil {
119+ return err
120+ }
121+ service .CountDefault = & maxFeatures
122+ }
123+
113124 if src .Spec .Service .Mapfile != nil {
114125 service .Mapfile = & pdoknlv3.Mapfile {
115126 ConfigMapKeyRef : src .Spec .Service .Mapfile .ConfigMapKeyRef ,
@@ -209,13 +220,16 @@ func (dst *WFS) ConvertFrom(srcRaw conversion.Hub) error {
209220 Keywords : src .Spec .Service .Keywords ,
210221 AccessConstraints : & accessConstraints ,
211222 DataEPSG : src .Spec .Service .DefaultCrs ,
212- Maxfeatures : src .Spec .Service .CountDefault ,
213223 Authority : Authority {
214224 Name : "" ,
215225 URL : "" ,
216226 },
217227 }
218228
229+ if src .Spec .Service .CountDefault != nil {
230+ service .Maxfeatures = smoothoperatorutils .Pointer (strconv .Itoa (* src .Spec .Service .CountDefault ))
231+ }
232+
219233 if src .Spec .Service .Bbox != nil {
220234 service .Extent = smoothoperatorutils .Pointer (src .Spec .Service .Bbox .DefaultCRS .ToExtent ())
221235 } else {
0 commit comments