@@ -313,6 +313,8 @@ func parseConfig(b []byte, opts *Options) (map[string]interface{}, error) {
313313 return yml , err
314314}
315315
316+ const extensions = "#extensions" // Using # prefix, we prevent risk to conflict with an actual yaml key
317+
316318func groupXFieldsIntoExtensions (dict map [string ]interface {}) map [string ]interface {} {
317319 extras := map [string ]interface {}{}
318320 for key , value := range dict {
@@ -325,7 +327,7 @@ func groupXFieldsIntoExtensions(dict map[string]interface{}) map[string]interfac
325327 }
326328 }
327329 if len (extras ) > 0 {
328- dict [" extensions" ] = extras
330+ dict [extensions ] = extras
329331 }
330332 return dict
331333}
@@ -364,7 +366,7 @@ func loadSections(filename string, config map[string]interface{}, configDetails
364366 if err != nil {
365367 return nil , err
366368 }
367- extensions := getSection (config , " extensions" )
369+ extensions := getSection (config , extensions )
368370 if len (extensions ) > 0 {
369371 cfg .Extensions = extensions
370372 }
@@ -526,7 +528,7 @@ func formatInvalidKeyError(keyPrefix string, key interface{}) error {
526528func LoadServices (filename string , servicesDict map [string ]interface {}, workingDir string , lookupEnv template.Mapping , opts * Options ) ([]types.ServiceConfig , error ) {
527529 var services []types.ServiceConfig
528530
529- x , ok := servicesDict [" extensions" ]
531+ x , ok := servicesDict [extensions ]
530532 if ok {
531533 // as a top-level attribute, "services" doesn't support extensions, and a service can be named `x-foo`
532534 for k , v := range x .(map [string ]interface {}) {
0 commit comments