From 0ebd448ed733ad8e86720c4a595115e2ac67f421 Mon Sep 17 00:00:00 2001 From: Yamashou <1230124fw@gmail.com> Date: Wed, 30 Oct 2024 12:28:43 +0900 Subject: [PATCH] EarlySourceInjector is deprecated. imprement EarlySoourcesIngjector --- generator/generator.go | 8 +++++++- main.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/generator/generator.go b/generator/generator.go index 0625cb3..0d11aa1 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -72,7 +72,13 @@ func Generate(ctx context.Context, cfg *config.Config, options ...api.Option) er return fmt.Errorf("failed to create federation plugin: %w", err) } - if fed, ok := fedPlugin.(plugin.EarlySourceInjector); ok { + if fed, ok := fedPlugin.(plugin.EarlySourcesInjector); ok { + if sources, err := fed.InjectSourcesEarly(); err == nil { + cfg.GQLConfig.Sources = append(cfg.GQLConfig.Sources, sources...) + } else { + return fmt.Errorf("failed to inject federation directives: %w", err) + } + } else if fed, ok := fedPlugin.(plugin.EarlySourceInjector); ok { if source := fed.InjectSourceEarly(); source != nil { cfg.GQLConfig.Sources = append(cfg.GQLConfig.Sources, source) } diff --git a/main.go b/main.go index 6c9893e..d5bf3ce 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( "github.com/urfave/cli/v2" ) -const version = "0.25.3" +const version = "0.25.4" var versionCmd = &cli.Command{ Name: "version",