Skip to content

Commit 3f229a9

Browse files
authored
Align JSON settings to v2 changes (#34)
In v2 we should use `json_settings` from `blacksheep.settings.json` instead of `json_plugin` from `blacksheep.plugins`
1 parent 2226060 commit 3f229a9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/settings.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ By default, the built-in `json` module is used for serializing and
6666
deserializing objects, but this can be changed in the way illustrated below.
6767

6868
```python
69-
from blacksheep.plugins import json
69+
from blacksheep.settings.json import json_settings
7070

7171

7272
def custom_loads(value):
@@ -81,7 +81,7 @@ def custom_dumps(value):
8181
"""
8282

8383

84-
json.use(
84+
json_settings.use(
8585
loads=custom_loads,
8686
dumps=custom_dumps,
8787
)
@@ -101,14 +101,14 @@ deserialization with the built-in [`responses`](../responses/) and
101101
```python
102102
import orjson
103103

104-
from blacksheep.plugins import json
104+
from blacksheep.settings.json import json_settings
105105

106106

107107
def serialize(value) -> str:
108108
return orjson.dumps(value).decode("utf8")
109109

110110

111-
json.use(
111+
json_settings.use(
112112
loads=orjson.loads,
113113
dumps=serialize,
114114
)
@@ -156,7 +156,7 @@ this possibility, it doesn't handle objects inside lists, `@dataclass`, or
156156
import json
157157
from typing import Any
158158

159-
from blacksheep.plugins import json as json_plugin
159+
from blacksheep.settings.json import json_settings
160160
from essentials.json import dumps
161161

162162

@@ -188,7 +188,7 @@ def custom_dumps(value: Any) -> str:
188188
return default_json_dumps(value)
189189

190190

191-
json_plugin.use(
191+
json_settings.use(
192192
loads=custom_loads,
193193
dumps=custom_dumps,
194194
)

0 commit comments

Comments
 (0)