Absinth dynamic schema generation at runtime

Hi,

currently I’m researching how can we offer a GraphQL API for user owned schemas and data. Something like described in this blog post: https://www.contentful.com/blog/2018/12/21/dynamic-schema-generation-changing-data-models/

But the author didn’t write how to do it.

Is something like this possible with Absinthe?

In 2 words, I want users to be able to create/modify any schema and get a GraphQL endpoint for them like you would normally expect from a typical project.

Thanks

I know this is an old post, but I’ve been digging into ways to help automate schema generation.

There are 2 related mix tasks:

mix absinthe.schema.json
mix absinthe.schema.sdl

but these generate artifacts based on defined Absinthe schemas. It sounds like you’re interested in going the other way: consuming files like this in order to generate a GraphQL schema. I like this idea a lot, but I’m not aware of anyone having implemented something like this in Elixir.

With more recent versions of Absinthe, it relies on a long list of blueprint structs to define objects and inputs, so in theory, this should totally be possible. If anyone has done work on this, I’d be very curious to see it.

Tangentially related: Absinthe & Authorisation & Generating Schemas

1 Like

Related: Missing documentation: Using imported SDL · Issue #1092 · absinthe-graphql/absinthe · GitHub