You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compilation of the following schema module runs into an infinite recursion:
defmoduleSomeSchemadouseAbsinthe.Schemaimport_sdl""" interface Animal { eats: [Food!]! } interface Food { eatenBy: Animal! } type Cat implements Animal { eats: [CatFood!]! } type Dog implements Animal { eats: [DogFood!]! } type CatFood implements Food { eatenBy: Cat! } type DogFood implements Food { eatenBy: Dog! } """end
It's easy to reproduce: create a new project with mix new, and add absinthe ~> 1.7.6 as a dependency. Run mix deps.get and mix deps.compile. Add the above module to the project, and try to compile the app with mix compile. It will not terminate.
Actual behavior
The compilation takes a very long time and seems like it eats up all the available memory. The OS kills the compilation process after some time.
It I use the interface name instead of the type name at least on one side of the relation, the schema compiles.
Interestingly it works when I turn the eatenBy fields type to Animal in the CatFood and DogFood types:
typeCatFoodimplementsFood { eatenBy: Animal! } # was `eatenBy: Cat`typeDogFoodimplementsFood { eatenBy: Animal! } # was `eatenBy: Dog`
It also works when the eatenBy stays CatFood and DogFood, but the eats fields type is changed to Food in Cat and `Dog:
typeCatimplementsAnimal { eats: [Food!]! } # was `eats: CatFood`typeDogimplementsAnimal { eats: [Food!]! } # was `eats: DogFood`
Environment
Elixir version: tried with several versions from 24.3.4 up to 26.2.2
Absinthe version: 1.7.6
The text was updated successfully, but these errors were encountered:
I suspect this happens in the ObjectMustImplementInterfaces phase. It does covariant checking there and can get quite difficult to follow. There's also some normalization happening.
I don't have time to work on it but wanted to point to what I think is happening.
The compilation of the following schema module runs into an infinite recursion:
It's easy to reproduce: create a new project with
mix new
, and addabsinthe ~> 1.7.6
as a dependency. Runmix deps.get
andmix deps.compile
. Add the above module to the project, and try to compile the app withmix compile
. It will not terminate.Actual behavior
The compilation takes a very long time and seems like it eats up all the available memory. The OS kills the compilation process after some time.
It I use the interface name instead of the type name at least on one side of the relation, the schema compiles.
Interestingly it works when I turn the eatenBy fields type to Animal in the CatFood and DogFood types:
It also works when the eatenBy stays
CatFood
andDogFood
, but theeats
fields type is changed toFood
inCat
and `Dog:Environment
The text was updated successfully, but these errors were encountered: