chore: handle push of unchanged schema

This commit is contained in:
2022-10-14 22:41:56 +02:00
parent eb41e24002
commit b1124d6350
10 changed files with 866 additions and 61 deletions
+14 -9
View File
@@ -2,6 +2,7 @@ package ctl
import (
"context"
"fmt"
"net/http"
"net/url"
@@ -47,15 +48,19 @@ func List(apiKey, schemaRef, service string, schemasUrl url.URL) ([]*SubGraph, e
if err != nil {
return nil, err
}
subGraphs := make([]*SubGraph, len(response.SubGraphs))
for i, subGraph := range response.SubGraphs {
subGraphs[i] = &SubGraph{
Service: subGraph.Service,
URL: subGraph.Url,
WSUrl: subGraph.WsUrl,
ChangedBy: subGraph.ChangedBy,
ChangedAt: subGraph.ChangedAt,
var subGraphs []*SubGraph
if s, ok := response.Supergraph.(*SubGraphsSupergraphSubGraphs); ok {
subGraphs = make([]*SubGraph, len(s.SubGraphs))
for i, subGraph := range s.SubGraphs {
subGraphs[i] = &SubGraph{
Service: subGraph.Service,
URL: subGraph.Url,
WSUrl: subGraph.WsUrl,
ChangedBy: subGraph.ChangedBy,
ChangedAt: subGraph.ChangedAt,
}
}
return subGraphs, nil
}
return subGraphs, nil
return nil, fmt.Errorf("unexpected response type")
}