View Source Spark.Dsl.Fragment (spark v2.2.36)

Allows splitting up a DSL into multiple modules, potentially organizing large DSLs

Use the of option to expression what your fragment is a fragment of. You can add extensions as you would normally to that resource, and they will be added to the parent resource.

defmodule MyApp.Resource.Graphql do
  use Spark.Dsl.Fragment, of: Ash.Resource, extensions: AshGraphql.Resource

  graphql do
    ...
  end
end

Then add the fragment to the parent resource.

defmodule MyApp.Resource do
  use Ash.Resource, fragments: [MyApp.Resource.Graphql], ...
end