Skip to content

Commit

Permalink
Ariadne 0.24 docs and release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Dec 19, 2024
1 parent d26e85b commit 7257450
Show file tree
Hide file tree
Showing 9 changed files with 1,720 additions and 38 deletions.
6 changes: 3 additions & 3 deletions docs/asgi-handlers-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ error message and 400 status code is returned instead.
#### `extract_data_from_request`

```python
async def extract_data_from_request(self, request: Request) -> None:
async def extract_data_from_request(self, request: Request) -> Union[dict, list]:
...
```

Extracts GraphQL request data from request.

Returns a `dict` with GraphQL query data that was not yet validated.
Returns a `dict` or `list` with GraphQL query data that was not yet validated.


##### Required arguments
Expand Down Expand Up @@ -207,7 +207,7 @@ async def extract_data_from_multipart_request(

Extracts GraphQL data from `multipart/form-data` request.

Returns an unvalidated `dict` with GraphQL query data.
Returns an unvalidated `dict` or `list` with GraphQL query data.


##### Required arguments
Expand Down
30 changes: 0 additions & 30 deletions docs/constants-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,4 @@ DATA_TYPE_JSON = 'application/json'

```python
DATA_TYPE_MULTIPART = 'multipart/form-data'
```


- - - - -


## `HTTP_STATUS_200_OK`

```python
HTTP_STATUS_200_OK = '200 OK'
```


- - - - -


## `HTTP_STATUS_400_BAD_REQUEST`

```python
HTTP_STATUS_400_BAD_REQUEST = '400 Bad Request'
```


- - - - -


## `HTTP_STATUS_405_METHOD_NOT_ALLOWED`

```python
HTTP_STATUS_405_METHOD_NOT_ALLOWED = '405 Method Not Allowed'
```
31 changes: 26 additions & 5 deletions docs/exceptions-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ Raised when request did not contain the data required to execute
the GraphQL query.


### Constructor

```python
def __init__(self, message: Optional[str] = None):
...
```

Initializes the `HttpBadRequestError` with optional error message.


- - - - -


Expand All @@ -102,17 +112,28 @@ Base class for HTTP errors raised inside the ASGI and WSGI servers.
### Constructor

```python
def __init__(self, message: Optional[str] = None):
def __init__(self, status: str, message: Optional[str] = None):
...
```

Initializes the `HttpError` with optional error message.
Initializes the `HttpError` with a status and optional error message.


#### Optional arguments
#### Arguments

`message`: a `str` with error message to return in response body or
`None`.
`status`: HTTP status code as `HttpStatusResponse`.
`message`: Optional error message to return in the response body.


- - - - -


## `HttpStatusResponse`

```python
class HttpStatusResponse(Enum):
...
```


- - - - -
Expand Down
2 changes: 2 additions & 0 deletions docs/explorers.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Embedded Apollo Sandbox.

- `title: str = "Ariadne GraphQL"` - Used for page title and loading message.
- `default_query: str = "..."` - Default content of editor area.
- `include_cookies: bool: bool = False` - Controls if Apollo explorer should include cookies in requests.


## GraphQL Playground
Expand All @@ -58,6 +59,7 @@ GraphQL Playground was default explorer in Ariadne until 0.17 release. **It's no
`ExplorerPlayground` constructor accepts following options:

- `title: str = "Ariadne GraphQL"` - Used for page title and loading message.
- `share_enabled: bool = False` - Controls share playground feature.
- `editor_cursor_shape: Optional[str] = None` - Controls `editor.cursorShape` setting (defaults to `"line"`, can be changed to `"block"` or `"underline"`).
- `editor_font_family: Optional[str] = None` - Controls `editor.fontFamily` setting (defaults to `"'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace"`).
- `editor_font_size: Optional[int] = None` - Controls `editor.fontSize` setting (defaults to `14`).
Expand Down
51 changes: 51 additions & 0 deletions website/blog/2024-12-19-ariadne-0-24.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Ariadne 0.24
---

Ariadne 0.24 is now available.

Ariadne 0.24 is a maintenance release that implements improvements and fixes to reported issues.

<!--truncate-->

## Added validation for directive declarations in `make_executable_schema` to prevent schema creation with undeclared directives

`SchemaDirectiveVisitor` that `make_executable_schema` uses for GraphQL directives will now raise the `ValueError` if directive is not declared in the GraphQL schema.


## Added `include_cookies` option to the `ExplorerApollo`

Apollo Explorer's `includeCookies` option can now be enabled in Ariadne via the `include_cookies` kwarg.


## Added `share_enabled` param to `ExplorerPlayground` to enable share playground feature

GraphQL Playground's `shareEnabled` option can now be enabled in Ariadne via the `share_enabled` kwarg.


## Added support for nested attribute resolution in alias resolvers

Ariadne's `resolve_to` utility now supports data structure traversal in created resolvers when `.` is used in the `attr_name` argument:

```python
resolver = resolve_to("attr.child_attr.deeper_child_attr")
```


## Replaced regexes in the Apollo Federation implementation with cleaner approach using GraphQL AST

Ariadne used series of regexes to process GraphQL schemas used for Apollo Federation. This approach was prone to errors and edge cases.

In 0.24 this approach was replaced with new one that instead parses schema to AST.


## CHANGELOG

- Added validation for directive declarations in `make_executable_schema` to prevent schema creation with undeclared directives.
- Replaced hardcoded HTTP statuses with `HTTPStatus` from the `http` stdlib module.
- Added `include_cookies` option to the `ExplorerApollo`.
- Fixed typing on `extract_data_from_request` method.
- Fixed tests websockets after starlette update.
- Added `share_enabled` param to `ExplorerPlayground` to enable share playground feature.
- Added support for nested attribute resolution in alias resolvers.
- Replaced regexes in the Apollo Federation implementation with cleaner approach using GraphQL AST.
Loading

0 comments on commit 7257450

Please sign in to comment.