@@ -309,6 +309,7 @@ func Load(configDetails types.ConfigDetails, options ...func(*Options)) (*types.
309309// LoadWithContext reads a ConfigDetails and returns a fully loaded configuration as a compose-go Project
310310func LoadWithContext (ctx context.Context , configDetails types.ConfigDetails , options ... func (* Options )) (* types.Project , error ) {
311311 opts := toOptions (& configDetails , options )
312+
312313 dict , err := loadModelWithContext (ctx , & configDetails , opts )
313314 if err != nil {
314315 return nil , err
@@ -366,6 +367,11 @@ func loadYamlModel(ctx context.Context, config types.ConfigDetails, opts *Option
366367 dict = map [string ]interface {}{}
367368 err error
368369 )
370+ sch , err := schema .CreateComposeSchema ()
371+ if err != nil {
372+ return nil , fmt .Errorf ("could not initialise schema: %w" , err )
373+ }
374+
369375 for _ , file := range config .ConfigFiles {
370376 fctx := context .WithValue (ctx , consts.ComposeFileKey {}, file .Filename )
371377 if file .Content == nil && file .Config == nil {
@@ -427,7 +433,7 @@ func loadYamlModel(ctx context.Context, config types.ConfigDetails, opts *Option
427433 }
428434
429435 if ! opts .SkipValidation {
430- if err := schema .Validate (dict ); err != nil {
436+ if err := sch .Validate (dict ); err != nil {
431437 return fmt .Errorf ("validating %s: %w" , file .Filename , err )
432438 }
433439 if _ , ok := dict ["version" ]; ok {
0 commit comments