graphql schema like this:

```js
type User {
  id: ID!
  location: Location
}

type Location {
  id: ID!
  user: User
}

```

Now, the client sends a `graphql` query. Theoretically, the `User` and `Location` can circular reference each other infinitely.

I think it's an anti-pattern. For my known, there is no middleware or way to limit the nesting depth of query both in `graphql` and `apollo` community.

This infinite nesting depth query will cost a lot of resources for my system, like bandwidth, hardware, performance. Not only server-side, but also client-side.

So, if graphql schema allow circular reference, there should be some middlewares or ways to limit the nesting depth of query. Or, add some constraints for the query.

Maybe do not allow circular reference is a better idea?

I prefer to sending another query and doing multiple operations in one query. It's much more simple.

**Update**

I found this library: <https://github.com/slicknode/graphql-query-complexity>. If graphql doesn't limit circular reference. This library can protect your application against resource exhaustion and DoS attacks.