Ariadne 0.4.0
Ariadne 0.4.0 is now available, and with it bunch of features and improvements for developer experience, and bugfixes!
ASGI 3
Our ASGI application has been updated to support version 3 of ASGI protocol, courtesy of Starlette 0.12.
Easier Django integration
We want to make process of starting out with GraphQL in Django easy. In Ariadne 0.3 we've provided example code on our docs that you could've copypasted to your project.
This approach was less than optimal, so in Ariadne 0.4 we are introducing ariadne.contrib.django
package that acts as Django app and provides GraphQL view that you can simply drop in your urls.py
:
from ariadne.contrib.django.views import GraphQLView
from django.urls import path
from .schema import schema
urlpatterns = [
...
path('graphql/', GraphQLView.as_view(schema=schema), name='graphql'),
]
To to sweeten the deal even, we are also providing two scalar implementations: Date
and Datetime
. Those two enable developers to exchange dates and datetimes between their UI and Python logic.
Error reporting improvements
In Ariadne 0.3 we've introduced extended error formatting support that added error's backtrace and content to GraphQL response, making it so much easier to get to source of the problem when debugging resolvers.
In 0.4 we are further improving error reporting with introduction of error logging.
Internally Ariadne creates own logger, and then logs all errors and exceptions to it, enabling you to stay on the top of the situation. We've took extra care to make sure that logged errors contain not only information about field in GraphQL query that failed to resolve, but also actual exception data. It also plays good with existing error tracking systems like Sentry:
Keeping you covered
Based on feedback and reports we've received from early adopters we've added bunch of assertions and checks around our API to fail fast and let you spot your errors before your users do.
Also, because in 99% of cases custom scalar literal parser is just a thin wrapper unpacking value from AST ValueNode
and passing for value_parser, Ariadne 0.4 will provide this mechanism for you out of the box. If you still need custom literal handling logic - you can still do it.
CHANGELOG
Above were only the highlights of this release. Here's complete changelog for those interested in nitty-gritty details:
- Updated
graphql-core-next
to 1.0.4 which has feature parity with GraphQL.js 14.3.1 and better type annotations. ariadne.asgi.GraphQL
is now an ASGI3 application. ASGI3 is now handled by all ASGI servers.ObjectType.field
andSubscriptionType.source
decorators now raise ValueError when used without name argument (eg.@foo.field
).ScalarType
will now use default literal parser that unpacksast.value
and calls value parser if scalar has value parser set.- Updated
ariadne.asgi.GraphQL
andariadne.wsgi.GraphQL
to support callables forcontext_value
androot_value
options. - Added
logger
option toariadne.asgi.GraphQL
,ariadne.wsgi.GraphQL
andariadne.graphql.*
utils. - Added default logger that logs to
ariadne
. - Added support for
extend type
in schema definitions. - Removed unused
format_errors
utility function and renamedariadne.format_errors
module toariadne.format_error
. - Removed explicit
typing
dependency. - Added
ariadne.contrib.django
package that provides Django class-based view together withDate
andDatetime
scalars. - Fixed default ENUM values not being set.
- Updated project setup so mypy ran in projects with Ariadne dependency run type checks against it's annotations.
- Updated Starlette to 0.12.0.