Skip to main content

Ariadne 0.16.0

· 2 min read

Ariadne 0.16 release brings refactor to Ariadne's ASGI app which makes it more modular and adds support for old and new GraphQL websocket protocols. It also updates load_schema_from_path to support gql and graphqls file types. Finally it bumps library's support for Starlette to version 0.20 and updates other dependencies to latest versions.

We thank our community for contributing features to this release. You rock! ❤️

Refactored ariadne.asgi.GraphQL

GraphQL's HTTP and WebSocket protocols support has been factored out to separate classes, making it easier to implement and customize HTTP and WebSocket handling.

Updating to 0.16

If you are using subscriptions in your GraphQL API, you have to update your code:

from ariadne.asgi import GraphQL
from ariadne.asgi.handlers import GraphQLWSHandler

app = GraphQL(
schema,
websocket_handler=GraphQLWSHandler(),
)

If you used event handlers for websocket connections, those should now be set on WebSocket handler directly:

from ariadne.asgi import GraphQL
from ariadne.asgi.handlers import GraphQLWSHandler

app = GraphQL(
schema,
websocket_handler=GraphQLWSHandler(
on_connect=...,
on_disconnect=...,
on_operation=...,
on_complete=...,
),
)

gql and graphqls support for load_schema_from_path

load_schema_from_path will now load files with gql and graphqls extensions in addition to graphql.

CHANGELOG

  • Refactored ariadne.asgi.GraphQL to use strategy pattern for handling HTTP and WebSockets.
  • Updated load_schema_from_path to also support .gql and .graphqls files.
  • Added support for starlette 0.20.