movio / bramble

A federated GraphQL API gateway
https://movio.github.io/bramble/
MIT License
497 stars 53 forks source link

Only return Fields, Types for Services with Schema #207

Closed pkqk closed 1 year ago

pkqk commented 1 year ago

Unreachable services haven't loaded a schema yet so the definition is nil, causing the meta plugins query to fail with a nil dereference panic.

nmaquet commented 1 year ago

I think it would be slightly nicer to add

if schema == nil {
    return nil
}

to both getTypes and getFields instead of changing the Services method? It's of course equivalent but it will avoid others making the same mistake in the future and keeps the loop in Services() tidier.