@@ -132,7 +132,7 @@ type ServiceConfig struct {
132132 VolumesFrom []string `yaml:"volumes_from,omitempty" json:"volumes_from,omitempty"`
133133 WorkingDir string `yaml:"working_dir,omitempty" json:"working_dir,omitempty"`
134134
135- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
135+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
136136}
137137
138138// MarshalYAML makes ServiceConfig implement yaml.Marshaller
@@ -280,7 +280,7 @@ type BuildConfig struct {
280280 Platforms StringList `yaml:"platforms,omitempty" json:"platforms,omitempty"`
281281 Privileged bool `yaml:"privileged,omitempty" json:"privileged,omitempty"`
282282
283- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
283+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
284284}
285285
286286// BlkioConfig define blkio config
@@ -292,23 +292,23 @@ type BlkioConfig struct {
292292 DeviceWriteBps []ThrottleDevice `yaml:"device_write_bps,omitempty" json:"device_write_bps,omitempty"`
293293 DeviceWriteIOps []ThrottleDevice `yaml:"device_write_iops,omitempty" json:"device_write_iops,omitempty"`
294294
295- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
295+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
296296}
297297
298298// WeightDevice is a structure that holds device:weight pair
299299type WeightDevice struct {
300300 Path string
301301 Weight uint16
302302
303- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
303+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
304304}
305305
306306// ThrottleDevice is a structure that holds device:rate_per_second pair
307307type ThrottleDevice struct {
308308 Path string
309309 Rate UnitBytes
310310
311- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
311+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
312312}
313313
314314// MappingWithColon is a mapping type that can be converted from a list of
@@ -320,7 +320,7 @@ type LoggingConfig struct {
320320 Driver string `yaml:"driver,omitempty" json:"driver,omitempty"`
321321 Options Options `yaml:"options,omitempty" json:"options,omitempty"`
322322
323- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
323+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
324324}
325325
326326// DeployConfig the deployment configuration for a service
@@ -335,7 +335,7 @@ type DeployConfig struct {
335335 Placement Placement `yaml:"placement,omitempty" json:"placement,omitempty"`
336336 EndpointMode string `yaml:"endpoint_mode,omitempty" json:"endpoint_mode,omitempty"`
337337
338- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
338+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
339339}
340340
341341// UpdateConfig the service update configuration
@@ -347,15 +347,15 @@ type UpdateConfig struct {
347347 MaxFailureRatio float32 `yaml:"max_failure_ratio,omitempty" json:"max_failure_ratio,omitempty"`
348348 Order string `yaml:"order,omitempty" json:"order,omitempty"`
349349
350- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
350+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
351351}
352352
353353// Resources the resource limits and reservations
354354type Resources struct {
355355 Limits * Resource `yaml:"limits,omitempty" json:"limits,omitempty"`
356356 Reservations * Resource `yaml:"reservations,omitempty" json:"reservations,omitempty"`
357357
358- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
358+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
359359}
360360
361361// Resource is a resource to be limited or reserved
@@ -367,15 +367,15 @@ type Resource struct {
367367 Devices []DeviceRequest `yaml:"devices,omitempty" json:"devices,omitempty"`
368368 GenericResources []GenericResource `yaml:"generic_resources,omitempty" json:"generic_resources,omitempty"`
369369
370- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
370+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
371371}
372372
373373// GenericResource represents a "user defined" resource which can
374374// only be an integer (e.g: SSD=3) for a service
375375type GenericResource struct {
376376 DiscreteResourceSpec * DiscreteGenericResource `yaml:"discrete_resource_spec,omitempty" json:"discrete_resource_spec,omitempty"`
377377
378- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
378+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
379379}
380380
381381// DiscreteGenericResource represents a "user defined" resource which is defined
@@ -386,7 +386,7 @@ type DiscreteGenericResource struct {
386386 Kind string `json:"kind"`
387387 Value int64 `json:"value"`
388388
389- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
389+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
390390}
391391
392392// RestartPolicy the service restart policy
@@ -396,7 +396,7 @@ type RestartPolicy struct {
396396 MaxAttempts * uint64 `yaml:"max_attempts,omitempty" json:"max_attempts,omitempty"`
397397 Window * Duration `yaml:"window,omitempty" json:"window,omitempty"`
398398
399- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
399+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
400400}
401401
402402// Placement constraints for the service
@@ -405,14 +405,14 @@ type Placement struct {
405405 Preferences []PlacementPreferences `yaml:"preferences,omitempty" json:"preferences,omitempty"`
406406 MaxReplicas uint64 `yaml:"max_replicas_per_node,omitempty" json:"max_replicas_per_node,omitempty"`
407407
408- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
408+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
409409}
410410
411411// PlacementPreferences is the preferences for a service placement
412412type PlacementPreferences struct {
413413 Spread string `yaml:"spread,omitempty" json:"spread,omitempty"`
414414
415- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
415+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
416416}
417417
418418// ServiceNetworkConfig is the network configuration for a service
@@ -424,7 +424,7 @@ type ServiceNetworkConfig struct {
424424 LinkLocalIPs []string `yaml:"link_local_ips,omitempty" json:"link_local_ips,omitempty"`
425425 MacAddress string `yaml:"mac_address,omitempty" json:"mac_address,omitempty"`
426426
427- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
427+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
428428}
429429
430430// ServicePortConfig is the port configuration for a service
@@ -435,7 +435,7 @@ type ServicePortConfig struct {
435435 Published string `yaml:"published,omitempty" json:"published,omitempty"`
436436 Protocol string `yaml:"protocol,omitempty" json:"protocol,omitempty"`
437437
438- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
438+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
439439}
440440
441441// ParsePortConfig parse short syntax for service port configuration
@@ -488,7 +488,7 @@ type ServiceVolumeConfig struct {
488488 Volume * ServiceVolumeVolume `yaml:"volume,omitempty" json:"volume,omitempty"`
489489 Tmpfs * ServiceVolumeTmpfs `yaml:"tmpfs,omitempty" json:"tmpfs,omitempty"`
490490
491- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
491+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
492492}
493493
494494// String render ServiceVolumeConfig as a volume string, one can parse back using loader.ParseVolume
@@ -534,7 +534,7 @@ type ServiceVolumeBind struct {
534534 Propagation string `yaml:"propagation,omitempty" json:"propagation,omitempty"`
535535 CreateHostPath bool `yaml:"create_host_path,omitempty" json:"create_host_path,omitempty"`
536536
537- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
537+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
538538}
539539
540540// SELinux represents the SELinux re-labeling options.
@@ -565,7 +565,7 @@ const (
565565type ServiceVolumeVolume struct {
566566 NoCopy bool `yaml:"nocopy,omitempty" json:"nocopy,omitempty"`
567567
568- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
568+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
569569}
570570
571571// ServiceVolumeTmpfs are options for a service volume of type tmpfs
@@ -574,7 +574,7 @@ type ServiceVolumeTmpfs struct {
574574
575575 Mode uint32 `yaml:"mode,omitempty" json:"mode,omitempty"`
576576
577- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
577+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
578578}
579579
580580// FileReferenceConfig for a reference to a swarm file object
@@ -585,7 +585,7 @@ type FileReferenceConfig struct {
585585 GID string `yaml:"gid,omitempty" json:"gid,omitempty"`
586586 Mode * uint32 `yaml:"mode,omitempty" json:"mode,omitempty"`
587587
588- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
588+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
589589}
590590
591591// ServiceConfigObjConfig is the config obj configuration for a service
@@ -600,7 +600,7 @@ type UlimitsConfig struct {
600600 Soft int `yaml:"soft,omitempty" json:"soft,omitempty"`
601601 Hard int `yaml:"hard,omitempty" json:"hard,omitempty"`
602602
603- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
603+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
604604}
605605
606606// MarshalYAML makes UlimitsConfig implement yaml.Marshaller
@@ -637,14 +637,14 @@ type NetworkConfig struct {
637637 Attachable bool `yaml:"attachable,omitempty" json:"attachable,omitempty"`
638638 Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`
639639 EnableIPv6 bool `yaml:"enable_ipv6,omitempty" json:"enable_ipv6,omitempty"`
640- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
640+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
641641}
642642
643643// IPAMConfig for a network
644644type IPAMConfig struct {
645645 Driver string `yaml:"driver,omitempty" json:"driver,omitempty"`
646646 Config []* IPAMPool `yaml:"config,omitempty" json:"config,omitempty"`
647- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
647+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
648648}
649649
650650// IPAMPool for a network
@@ -663,7 +663,7 @@ type VolumeConfig struct {
663663 DriverOpts Options `yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`
664664 External External `yaml:"external,omitempty" json:"external,omitempty"`
665665 Labels Labels `yaml:"labels,omitempty" json:"labels,omitempty"`
666- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
666+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
667667}
668668
669669// External identifies a Volume or Network as a reference to a resource that is
@@ -675,7 +675,7 @@ type CredentialSpecConfig struct {
675675 Config string `yaml:"config,omitempty" json:"config,omitempty"` // Config was added in API v1.40
676676 File string `yaml:"file,omitempty" json:"file,omitempty"`
677677 Registry string `yaml:"registry,omitempty" json:"registry,omitempty"`
678- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
678+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
679679}
680680
681681// FileObjectConfig is a config type for a file used by a service
@@ -689,7 +689,7 @@ type FileObjectConfig struct {
689689 Driver string `yaml:"driver,omitempty" json:"driver,omitempty"`
690690 DriverOpts map [string ]string `yaml:"driver_opts,omitempty" json:"driver_opts,omitempty"`
691691 TemplateDriver string `yaml:"template_driver,omitempty" json:"template_driver,omitempty"`
692- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
692+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
693693}
694694
695695const (
@@ -708,7 +708,7 @@ type DependsOnConfig map[string]ServiceDependency
708708type ServiceDependency struct {
709709 Condition string `yaml:"condition,omitempty" json:"condition,omitempty"`
710710 Restart bool `yaml:"restart,omitempty" json:"restart,omitempty"`
711- Extensions Extensions `yaml:"#extensions,inline" json:"-"`
711+ Extensions Extensions `yaml:"#extensions,inline,omitempty " json:"-"`
712712 Required bool `yaml:"required" json:"required"`
713713}
714714
0 commit comments