forked from piccolo-orm/piccolo_api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCHANGES
452 lines (349 loc) · 10.3 KB
/
CHANGES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
Changes
=======
0.29.1
------
The ``__visible_fields`` filter on PiccoloCRUD now works on the detail endpoint
(courtesy @sinisaos). For example:
.. code-block:: text
GET /1/?__visible_fields=id,name,director.name
We also modified a type annotation in ``FastAPIWrapper``, so you can use it
with FastAPI's ``APIRouter`` without getting a type warning. Thanks to @gmos
for reporting this issue.
0.29.0
------
Added a ``__visible_fields`` filter to ``PiccoloCRUD``. It's a very powerful
feature which lets us specify which fields we want the API to return from a
GET request (courtesy @sinisaos).
It can even support joins, but we must supply a ``max_joins`` parameter:
.. code-block:: python
app = PiccoloCRUD(Movie, max_joins=1)
uvicorn(app)
Then we can do:
.. code-block:: text
GET /?__visible_fields=id,name,director.name
Which will return:
.. code-block:: javascript
{
"rows": [
{
"id": 17,
"name": "The Hobbit: The Battle of the Five Armies",
"director": {
"name": "Peter Jackson"
}
},
...
]
}
By specifying exactly which data we want returned, it is much more efficient,
especially when fetching large numbers of rows, or with tables with lots of
columns.
0.28.1
------
Fixed a bug with the delete endpoint of ``PiccoloCRUD``. It was returning a 204
response with a body (this isn't allowed, and could cause an exception to be
raised in the web server). Thanks to @trondhindenes for reporting this issue.
Updated Swagger UI to the latest version.
0.28.0
------
Modified the ``get_ids`` endpoint of ``PiccoloCRUD``, so it accepts an
``offset`` query parameter. It already supported ``limit``.
0.27.0
------
You can now pass a ``schema_extra`` argument to ``PiccoloCRUD``, which is
added to the underlying Pydantic schema.
0.26.0
------
``create_pydantic_model`` is now imported from the main Piccolo repo.
0.25.1
------
* Added examples to CSRF docs (courtesy @sinisaos).
* Improved ``SessionAuthBackend`` - it was too aggressive at rejecting
requests when ``allow_unauthenticated=True`` (thanks to @Bakz for reporting
this).
0.25.0
------
If you send a GET request to the ``session_logout`` endpoint, it will now
render a simple logout form. This makes it work much nicer out of the box.
Thanks to @sinisaos for adding this.
0.24.1
------
When using the ``nested` argument in ``create_pydantic_model``, more of the
other arguments are passed to the nested models. For example, if
``include_default_columns`` is ``True``, both the parent and child models will
include their default columns.
0.24.0
------
Added support for nested models in ``create_pydantic_model``. For each
``ForeignKey`` in the Piccolo table, the Pydantic model will contain a sub
model for the related table.
For example:
.. code-block::
class Manager(Table):
name = Varchar()
class Band(Table):
name = Varchar()
manager = ForeignKey(Manager)
BandModel = create_pydantic_model(Band, nested=True)
If we were to write ``BandModel`` by hand instead, it would look like this:
.. code-block::
class ManagerModel(BaseModel):
name: str
class BandModel(BaseModel):
name: str
manager: ManagerModel
This feature is designed to work with the new ``nested`` output option in
Piccolo >= 0.40.0, which returns the data in the correct format to pass
directly to the nested Pydantic model.
.. code-block::
band = Band.select(
Band.id,
Band.name,
*Band.manager.all_columns()
).first(
).output(
nested=True
).run_sync()
>>> print(band)
{'id': 1, 'name': 'Pythonistas', 'manager': {'id': 1, 'name': 'Guido'}}
BandModel(**band)
Courtesy @aminalaee.
0.23.1
------
Make sure ``asyncpg`` gets installed, as Piccolo API currently has a hard
requirement on it (we hope to fix this in the future).
0.23.0
------
* Fixed MyPy errors (courtesy @sinisaos).
* Simplification of JWT authentication - it no longer needlessly checks
expiry, as PyJWT already does this (courtesy @aminalaee).
* Substantial increase in code coverage (courtesy @aminalaee and @sinisaos).
* Increased the minimum PyJWT version, as versions > 2.0.0 return the JWT as a
string instead of bytes.
* Added an option to exclude columns when using ``create_pydantic_model``
(courtesy @kucera-lukas).
0.22.0
------
Updating ``PiccoloCRUD`` so it works better with the custom primary key feature
added in Piccolo.
0.21.1
------
Minor changes to the custom login template logic. More complex Jinja templates
are now supported (which are extended from other Jinja templates).
0.21.0
------
Session auth improvements:
* The default login template is much nicer now.
* The login template can be overridden with a custom one, to match the look
and feel of the application.
* The ``session_logout`` endpoint can now redirect after successfully logging
out.
0.20.0
------
When using the ``swagger_ui`` endpoint, the title can now be customised -
courtesy @heliumbrain.
0.19.0
------
* Added an ``allow_unauthenticated`` option to ``SessionsAuthBackend``, which
will add an ``UnauthenticatedUser`` to the scope, instead of rejecting the
request. The app's endpoints are then responsible for checking
``request.user.is_authenticated``.
* Improved the docs for Session Auth.
* If ``deserialize_json`` is False on ``create_pydantic_model``, it will
still provide some JSON validation.
0.18.0
------
Added a ``deserialize_json`` option to ``create_pydantic_model``, which will
convert JSON strings to objects - courtesy @heliumbrain.
0.17.1
------
Added the OAuth redirect endpoint to ``swagger_ui``.
0.17.0
------
Added a ``swagger_ui`` endpoint which works with Piccolo's ``CSRFMiddleware``.
0.16.0
------
Modified the auth middleware to add the Piccolo `BaseUser` instance for the
authenticated user to Starlette's `BaseUser`.
0.15.1
------
Add missing `login.html` template.
0.15.0
------
Added support for ``choices`` argument in Piccolo ``Column`` instances. The
choices are output in the schema endpoint of ``PiccoloCRUD``.
0.14.1
------
Added ``validators`` and ``exclude_secrets`` arguments to ``PiccoloCRUD``.
0.14.0
------
Added ``superuser_only`` and ``active_only`` options to ``SessionsAuthBackend``.
0.13.0
------
Added support for ``Array`` column types.
0.12.13
-------
Added ``py.typed`` file, for MyPy.
0.12.12
-------
Exposing the ``help_text`` value for ``Table`` in the Pydantic schema.
0.12.11
-------
Exposing the ``help_text`` value for ``Column`` in the Pydantic schema.
0.12.10
-------
Fixing a bug with ``ids`` endpoint when there's a limit but no search.
0.12.9
------
Fixing ``ids`` endpoint in ``PiccoloCRUD`` with Postgres - search wasn't
working.
0.12.8
------
The ``ids`` endpoint in ``PiccoloCRUD`` now accepts a limit parameter.
0.12.7
------
Added additional validation to Pydantic serialisers - for example, ``Varchar``
max length, and ``Decimal`` / ``Numeric`` precision and scale.
0.12.6
------
The ``ids`` endpoint in ``PiccoloCRUD`` is now searchable.
0.12.5
------
Added missing ``new`` endpoint to ``FastAPIWrapper`` - courtesy sinisaos.
0.12.4
------
Made FastAPI a requirements, instead of an optional requirement.
0.12.3
------
* Added ids and references endpoints to ``FastAPIWrapper``.
* Increase compatibility of ``SessionLoginEndpoint`` and ``CSRFMiddleware`` -
adding a CSRF token as a form field should now work.
0.12.2
------
* Added docstrings to FastAPI endpoints in ``FastAPIWrapper``.
* Exposing count and schema endpoints in ``FastAPIWrapper``.
0.12.1
------
* Added docs for ``__page`` and ``__page_size`` query parameters for
``PiccoloCRUD``.
* Implemented ``max_page_size`` to prevent excessive server load - courtesy
sinisaos.
0.12.0
------
Renaming migrations which were problematic for Windows users.
0.11.4
------
Using Pydantic to serialise the ``PiccoloCRUD.new`` response. Fixes a bug
with serialising some values, such as ``decimal.Decimal``.
0.11.3
------
* Using Piccolo's ``run_sync`` instead of asgiref.
* Loosened dependencies.
* ``create_pydantic_model`` now supports lazy references in ``ForeignKey``
columns.
* MyPy fixes.
0.11.2
------
* ``PiccoloCRUD`` now supports the `__readable` query parameter for detail
endpoints - i.e. `/api/movie/1/?__readable=true`. Thanks to sinisaos for
the initial prototype.
* Improving type hints.
0.11.1
------
Bumped requirements.
0.11.0
------
Using ``Column._meta.required`` for Pydantic schema.
0.10.1
------
Can pass more configuration options to FastAPI via ``FastAPIWrapper``.
0.10.0
------
Updated for Piccolo 0.12.
0.9.2
-----
* Added ``FastAPIWrapper``, which makes building a FastAPI endpoint really
simple.
* Improved the handling of malformed queries better in ``PiccoloCRUD`` -
catching unrecognised column names, and returning a 400 response.
0.9.1
-----
``create_pydantic_model`` now accepts an optional `model_name` argument.
0.9.0
-----
Bumped requirements, to support Piccolo ``Numeric`` and ``Real`` column types.
0.8.0
-----
Improved session auth - can increase the expiry automatically, which improves
the user experience.
0.7.6
-----
Can choose to not redirect after a successful session auth login - this is
preferred when calling the endpoint via AJAX.
0.7.5
-----
Loosening requirements for Piccolo projects.
0.7.4
-----
Bumped requirements.
0.7.3
-----
Bumped requirements.
0.7.2
-----
Can configure where ``CSRFMiddleware`` looks for tokens, and bug fixes.
0.7.1
-----
CSRF tokens can now be passed as form values.
0.7.0
-----
Supporting Piccolo 0.10.0.
0.6.1
-----
Adding missing __init__.py file - was messing up release.
0.6.0
-----
New style migrations.
0.5.1
-----
Added support for PATCH queries, and specifying text filter types, to
PiccoloCRUD.
0.5.0
-----
Changed schema format.
0.4.4
-----
PiccoloCRUD 'new' endpoint works in readonly mode - doesn't save any data.
0.4.3
-----
Supporting order by, pagination, and filter operators in ``PiccoloCRUD``.
0.4.2
-----
Added 'new' endpoint to ``PiccoloCRUD``.
0.4.1
-----
Added missing __init__ files.
0.4.0
-----
Added token auth and rate limiting middleware.
0.3.2
-----
Updated Piccolo import paths.
0.3.1
-----
Updated Piccolo syntax.
0.3.0
-----
Improved code layout.
0.2.0
-----
Updating to work with Piccolo > 0.5.
0.1.3
-----
Added validation to PUT requests.
0.1.2
-----
Added foreign key support to schema.
0.1.1
-----
Changed import paths.