Packages

The extension for building GraphQL APIs with Ash

Current section

Files

Jump to
ash_graphql lib context_helpers.ex
Raw

lib/context_helpers.ex

# SPDX-FileCopyrightText: 2020 ash_graphql contributors <https://github.com/ash-project/ash_graphql/graphs.contributors>
#
# SPDX-License-Identifier: MIT
defmodule AshGraphql.ContextHelpers do
@moduledoc "Helper to extract context from its various locations"
def get_context(context) do
case Map.get(context, :context) do
nil ->
case Map.get(context, :ash_context) do
nil ->
%{}
context ->
IO.warn(
"Using `:ash_context` is deprecated, use `Ash.PlugHelpers.set_context/2` instead."
)
context
end
context ->
context
end
end
end