Settings🔗
In this section, we'll cover the settings that can be used to customize Undine.
Settings should be set in a dictionary named UNDINE
in your settings file, unless otherwise specified.
The settings can also be found in the settings file.
ADDITIONAL_VALIDATION_RULES
Type: list[type[ASTValidationRule]]
| Default: []
Additional validation rules to use for validating the GraphQL schema. Values should be given as the dotted paths to the validation rules used.
ALLOW_DID_YOU_MEAN_SUGGESTIONS
Type: bool
| Default: False
Whether to allow the 'did you mean' suggestions on error messages.
ALLOW_INTROSPECTION_QUERIES
Type bool
| Default: False
Whether schema introspection queries are allowed or not. Should set this to True
if using GraphiQL.
ASYNC
Type bool
| Default: False
Whether to use async view for the GraphQL endpoint or not. Allows using async resolvers
for Fields
and Entrypoints
. See Async Support for more information.
AUTOGENERATION
Type bool
| Default: True
Whether to automatically generate Fields
for QueryTypes
, Inputs
for MutationTypes
,
Filters
for FilterSets
, and Orders
for OrderSets
. Can also be set on an individual
QueryType
, MutationType
, FilterSet
, and OrderSet
classes.
CALCULATION_ARGUMENT_EXTENSIONS_KEY
Type: str
| Default: "undine_calculation_argument"
The key used to store a CalculationArgument
in the extensions
of the GraphQLArgument
.
CAMEL_CASE_SCHEMA_FIELDS
Type: bool
| Default: True
Should names be converted from 'snake_case' to 'camelCase' for the GraphQL schema?
Conversion is not applied if schema_name
is set manually.
CONNECTION_EXTENSIONS_KEY
Type: str
| Default: "undine_connection"
The key used to store a Connection
in the extensions
of the GraphQLObjectType
.
CONNECTION_INDEX_KEY
Type: str
| Default: "_undine_pagination_index"
The key to which a nested connection's pagination indexes are annotated to.
CONNECTION_PAGE_SIZE
Type: int
| Default: 100
The maximum number of items to return from a Connection at a time.
CONNECTION_START_INDEX_KEY
Type: str
| Default: "_undine_pagination_start"
The key to which a nested connection's pagination start indexes are annotated to.
CONNECTION_STOP_INDEX_KEY
Type: str
| Default: "_undine_pagination_stop"
The key to which a nested connection's pagination stop indexes are annotated to.
CONNECTION_TOTAL_COUNT_KEY
Type: str
| Default: "_undine_pagination_total_count"
The key to which a nested connection's total counts are annotated to.
DIRECTIVE_ARGUMENT_EXTENSIONS_KEY
Type: str
| Default: "undine_directive_argument"
The key used to store a DirectiveArgument
in the extensions
of the GraphQLArgument
.
DIRECTIVE_EXTENSIONS_KEY
Type str
| Default: "undine_directive"
The key used to store a Directive
in the extensions
of the GraphQLDirective
.
DISABLE_ONLY_FIELDS_OPTIMIZATION
Type bool
| Default: False
Disable optimizing fetched fields with queryset.only()
.
DOCSTRING_PARSER
Type type[DocstringParserProtocol]
| Default: "undine.parsers.parse_docstring.RSTDocstringParser"
The docstring parser to use. Should be given as the dotted path to the docstring parser class.
EMPTY_VALUES
Type Container[Any]
| Default: (None, "", [], {})
By default, if a Filter receives any of these values, it will be ignored.
Can be changed on per-filter basis using the empty_values
argument.
ENABLE_CLASS_ATTRIBUTE_DOCSTRINGS
Type bool
| Default: False
Whether to parse class attribute docstrings or not. Disabled by default to improve performance of the schema creation.
ENTRYPOINT_EXTENSIONS_KEY
Type str
| Default: "undine_entrypoint"
The key used to store an Entrypoint
in the extensions
of the GraphQLField
.
LIST_ENTRYPOINT_LIMIT
Type int | None
| Default: None
Default number of objects that are fetched per model when fetching results from a list Entrypoint (not Connections). If None, all items are fetched.
EXECUTION_CONTEXT_CLASS
Type type[UndineExecutionContext]
| Default: "undine.execution.UndineExecutionContext"
GraphQL execution context class used by the schema. Should be given as the dotted path to the execution context class.
EXECUTION_HOOKS
Type: list[type[LifecycleHook]]
| Default: []
Hooks to run during execution phase the GraphQL request. See Lifecycle Hooks for more information. Values should be given as the dotted paths to the lifecycle hooks used.
EXPERIMENTAL_VISIBILITY_CHECKS
Type: bool
| Default: False
Whether to enable experimental visibility checks. When enabled, parts of the schema can be hidden from certain users according to specified visibility checks. When a field is not visible to a user, it will not be included in introspection queries and it cannot be used in operations.
Note that visibility does not affect "did you mean" suggestions, so it is advised to disable
these using ALLOW_DID_YOU_MEAN_SUGGESTIONS
when using this feature.
FIELD_EXTENSIONS_KEY
Type: str
| Default: "undine_field"
The key used to store a Field
in the extensions
of the GraphQLField
.
FILE_UPLOAD_ENABLED
Type: bool
| Default: False
Whether file uploads are enabled. Should enable CSRF protection on the GraphiQL endpoint if enabled. See file uploads for more information.
FILTER_EXTENSIONS_KEY
Type: str
| Default: "undine_filter"
The key used to store a Filter
in the extensions
of the GraphQLInputField
.
FILTERSET_EXTENSIONS_KEY
Type: str
| Default: "undine_filterset"
The key used to store a FilterSet
in the extensions
of the GraphQLInputObjectType
.
GRAPHIQL_ENABLED
Type: bool
| Default: False
Whether to enable GraphiQL. Should also set ALLOW_INTROSPECTION_QUERIES
to True
, so that GraphiQL can introspect the GraphQL schema.
GRAPHQL_PATH
Type: str
| Default: "graphql/"
The URL path where the GraphQL endpoint is located
if it's included using path("", include("undine.http.urls"))
.
GRAPHQL_VIEW_NAME
Type: str
| Default: "graphql"
The name given to the GraphQL view in Django's URL resolvers
if it's included using path("", include("undine.http.urls"))
.
INCLUDE_ERROR_TRACEBACK
Type: bool
| Default: False
Whether to include the error traceback in the response error extensions.
INPUT_EXTENSIONS_KEY
Type: str
| Default: "undine_input"
The key used to store an Input
in the extensions
of the GraphQLInputField
.
INTERFACE_FIELD_EXTENSIONS_KEY
Type: str
| Default: "undine_interface_field"
The key used to store an InterfaceField
in the extensions
of the GraphQLField
.
INTERFACE_TYPE_EXTENSIONS_KEY
Type: str
| Default: "undine_interface"
The key used to store a InterfaceType
in the extensions
of the GraphQLInterfaceType
.
MAX_ALLOWED_ALIASES
Type: int
| Default: 15
The maximum number of aliases allowed in a single operation.
MAX_ALLOWED_DIRECTIVES
Type: int
| Default: 50
The maximum number of directives allowed in a single operation.
MAX_ERRORS
Type: int
| Default: 100
The maximum number of validation errors allowed in a GraphQL request before it is rejected, even if validation is still not complete.
MAX_FILTERS_PER_TYPE
Type: int
| Default: 20
The maximum number of filters allowed to be used for filtering a single QueryType
.
MAX_ORDERS_PER_TYPE
Type: int
| Default: 10
The maximum number of orderings allowed to be used for ordering a single QueryType
.
MAX_QUERY_COMPLEXITY
Type: int
| Default: 10
Maximum query complexity that is allowed to be queried in a single operation.
MAX_TOKENS
Type int
| Default: None
Maximum number of GraphQL document tokens the GraphQL parser will
parse before it rejects a request. By default, this is set to None
which means no limit.
MIDDLEWARE
Type: list[type[GraphQLFieldResolver]]
| Default: []
Middleware to use during GraphQL field resolving. See Custom Middleware in the GraphQL-core documentation for more information.
MODELTRANSLATION_INCLUDE_TRANSLATABLE
Type: bool
| Default: False
Whether to add translatable fields to the GraphQL schema when using django-modeltranslation
.
See the integration description for more information.
MODELTRANSLATION_INCLUDE_TRANSLATIONS
Type: bool
| Default: True
Whether to add translation fields to the GraphQL schema when using django-modeltranslation
.
See the integration description for more information.
MUTATION_FULL_CLEAN
Type: bool
| Default: True
Whether to run model.full_clean()
when mutating a model. Turning this off can reduce
the number of database queries during mutations, but may introduce issues that would
be solved by running full model validation.
MUTATION_INSTANCE_LIMIT
Type: int
| Default: 100
The maximum number of objects that can be mutated in a single mutation.
MUTATION_INPUT_DATA_KEY
Type: str
| Default: "input"
The key that the input argument based on a MutationType
is added to
when said MutationType
is used in Entrypoints
.
MUTATION_TYPE_EXTENSIONS_KEY
Type: str
| Default: "undine_mutation_type"
The key used to store a MutationType
in the extensions
of the GraphQLInputObjectType
.
NO_ERROR_LOCATION
Type: bool
| Default: False
Whether to remove error location information to GraphQL errors.
OPERATION_HOOKS
Type: list[type[LifecycleHook]]
| Default: []
Hooks to run encompassing the entire GraphQL operation. See Lifecycle Hooks for more information. Values should be given as the dotted paths to the lifecycle hooks used.
OPTIMIZER_CLASS
Type: type[QueryOptimizer]
| Default: "undine.optimizer.optimizer.QueryOptimizer"
The optimizer class to use for optimizing queries. Value should be given as the dotted path to the optimizer class.
ORDER_EXTENSIONS_KEY
Type: str
| Default: "undine_order"
The key used to store an Order
in the extensions
of the GraphQLEnumValue
.
ORDERSET_EXTENSIONS_KEY
Type: str
| Default: "undine_orderset"
The key used to store a OrderSet
in the extensions
of the GraphQLEnumType
.
PARSE_HOOKS
Type: list[type[LifecycleHook]]
| Default: []
Hooks to run during parsing phase of a GraphQL request. See Lifecycle Hooks for more information. Values should be given as the dotted paths to the lifecycle hooks used.
PERSISTED_DOCUMENTS_ONLY
Type: bool
| Default: False
Whether to only allow persisted documents to be executed in the GraphQL API.
PERSISTED_DOCUMENTS_PATH
Type: str
| Default: "persisted-documents/"
The path where the persisted documents registration endpoint is located by default.
PERSISTED_DOCUMENTS_PERMISSION_CALLBACK
Type: PersistedDocumentsPermissionsCallback
| Default: undine.persisted_documents.utils.default_permission_callback
The function to use for permission checks for registration of persisted documents.
PERSISTED_DOCUMENTS_VIEW_NAME
Type: str
| Default: "persisted_documents"
The name of given to the persisted documents registration view in the URLconf.
PG_TEXT_SEARCH_PREFIX
Type: str
| Default: "_undine_ts_vector"
A prefix to use for the filter aliases of postgres full text search Filters.
PREFETCH_HACK_CACHE_KEY
Type: str
| Default: "_undine_prefetch_hack_cache"
The key to use for storing the prefetch hack cache in the queryset hints.
QUERY_TYPE_EXTENSIONS_KEY
Type: str
| Default: "undine_query_type"
The key used to store a QueryType
in the extensions
of the GraphQLObjectType
.
QUERY_TYPE_FILTER_INPUT_KEY
Type: str
| Default: "filter"
The key that the input argument based on a FilterSet
of a QueryType
is added to
when said QueryType
is used in list Entrypoints
or "to-many" related Fields
.
QUERY_TYPE_ORDER_INPUT_KEY
Type: str
| Default: "orderBy"
The key that the input argument based on an OrderSet
of a QueryType
is added to
when said QueryType
is used in list Entrypoints
or "to-many" related Fields
.
RESOLVER_ROOT_PARAM_NAME
Type: str
| Default: "root"
The name of the root/parent parameter in Field
/Entrypoint
resolvers.
ROOT_TYPE_EXTENSIONS_KEY
Type: str
| Default: "undine_root_type"
The key used to store a RootType
in the extensions
of the GraphQLObjectType
.
ROOT_VALUE
Type: Any
| Default: None
The root value for the GraphQL execution. Can be accessed by Entrypoint
resolvers
from the root
argument.
SCALAR_EXTENSIONS_KEY
Type: str
| Default: "undine_scalar"
The key used to store a Undine ScalarType
in the extensions
of the GraphQLScalarType
.
SCHEMA
Type: GraphQLSchema
| Default: "undine.settings.example_schema"
The file and variable where the GraphQL Schema for Undine is located.
Value should be given as the dotted path, usually created using undine.schema.create_schema
.
SCHEMA_DIRECTIVES_EXTENSIONS_KEY
Type: str
| Default: "undine_schema_directives"
The key used to store the schema definition directives in the extensions
of the GraphQLSchema
.
SDL_PRINTER
Type: type[SDLPrinter]
| Default: "undine.utils.graphql.sdl_printer.SDLPrinter"
The SDL printer to use. Value should be given as the dotted path to the SDL printer class.
TESTING_CLIENT_FULL_STACKTRACE
Type: bool
| Default: False
Whether to include the full stacktrace in testing client instead of just the relevant frames when checking where SQL queries are made.
TOTAL_COUNT_PARAM_NAME
Type: str
| Default: "totalCount"
The name of the parameter in a connection ObjectType
for holding the count for the
total number of items that can be queried from the connection.
UNDINE_PERSISTED_DOCUMENTS_MODEL
Type: type[Model]
| Default: "undine.persisted_documents.models.PersistedDocument"
NOTE: This setting should be set in the top level of the settings file, not in the UNDINE
dictionary!
The model to use for the PersistedDocument
model. Works similarly to
AUTH_USER_MODEL
,
so must be set before running migrations for the persisted documents app.
UNION_TYPE_EXTENSIONS_KEY
Type: str
| Default: "undine_union_type"
The key used to store a Undine UnionType
in the extensions
of the GraphQLUnion
.
VALIDATION_HOOKS
Type: list[type[LifecycleHook]]
| Default: []
Hooks to run during validation the GraphQL request. See Lifecycle Hooks for more information. Values should be given as the dotted paths to the lifecycle hooks used.
WEBSOCKET_CONNECTION_INIT_HOOK
Type: WebSocketConnectionInitHook
| Default: "undine.utils.graphql.websocket.connection_init_hook"
The function to use for custom ConnectionInit
logic.
Value should be given as the dotted path to the function.
WEBSOCKET_CONNECTION_INIT_TIMEOUT_SECONDS
Type: int
| Default: 3
The number of seconds to wait for the ConnectionInit
message after opening a WebSocket before closing it.
WEBSOCKET_PATH
Type: str
| Default: "graphql/"
The path where the GraphQL over WebSocket endpoint is located
if using undine.integrations.channels.get_websocket_enabled_app
.
WEBSOCKET_PING_HOOK
Type: WebSocketConnectionPingHook
| Default: "undine.utils.graphql.websocket.ping_hook"
The function for specifying custom Ping
message logic.
Value should be given as the dotted path to the function.
WEBSOCKET_PONG_HOOK
Type: WebSocketConnectionPongHook
| Default: "undine.utils.graphql.websocket.pong_hook"
The function to for specifying custom Pong
message logic.
Value should be given as the dotted path to the function.