chore: update schema if URLs have changed

This commit is contained in:
2022-10-17 14:30:48 +02:00
parent 8a2410fae6
commit 6b454ca8bf
2 changed files with 13 additions and 1 deletions
+10
View File
@@ -27,3 +27,13 @@ func (r *Resolver) toGqlSubGraph(subGraph *domain.SubGraph) *model.SubGraph {
ChangedAt: subGraph.ChangedAt,
}
}
func (r *Resolver) stringEqual(s1, s2 *string) bool {
if s1 == nil && s2 == nil {
return true
}
if s1 != nil && s2 != nil && *s1 == *s2 {
return true
}
return false
}
+3 -1
View File
@@ -27,7 +27,9 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
if err != nil {
return nil, err
}
if strings.TrimSpace(input.Sdl) == strings.TrimSpace(subGraph.Sdl) {
if strings.TrimSpace(input.Sdl) == strings.TrimSpace(subGraph.Sdl) &&
r.stringEqual(input.URL, subGraph.Url) &&
r.stringEqual(input.WsURL, subGraph.WSUrl) {
return r.toGqlSubGraph(subGraph), nil
}
serviceSDLs := []string{input.Sdl}