@@ -334,6 +334,8 @@ func parseConfig(b []byte, opts *Options) (map[string]interface{}, error) {
334334 return yml , err
335335}
336336
337+ const extensions = "#extensions" // Using # prefix, we prevent risk to conflict with an actual yaml key
338+
337339func groupXFieldsIntoExtensions (dict map [string ]interface {}) map [string ]interface {} {
338340 extras := map [string ]interface {}{}
339341 for key , value := range dict {
@@ -346,7 +348,7 @@ func groupXFieldsIntoExtensions(dict map[string]interface{}) map[string]interfac
346348 }
347349 }
348350 if len (extras ) > 0 {
349- dict [" extensions" ] = extras
351+ dict [extensions ] = extras
350352 }
351353 return dict
352354}
@@ -385,7 +387,7 @@ func loadSections(filename string, config map[string]interface{}, configDetails
385387 if err != nil {
386388 return nil , err
387389 }
388- extensions := getSection (config , " extensions" )
390+ extensions := getSection (config , extensions )
389391 if len (extensions ) > 0 {
390392 cfg .Extensions = extensions
391393 }
@@ -547,7 +549,7 @@ func formatInvalidKeyError(keyPrefix string, key interface{}) error {
547549func LoadServices (filename string , servicesDict map [string ]interface {}, workingDir string , lookupEnv template.Mapping , opts * Options ) ([]types.ServiceConfig , error ) {
548550 var services []types.ServiceConfig
549551
550- x , ok := servicesDict [" extensions" ]
552+ x , ok := servicesDict [extensions ]
551553 if ok {
552554 // as a top-level attribute, "services" doesn't support extensions, and a service can be named `x-foo`
553555 for k , v := range x .(map [string ]interface {}) {
0 commit comments