Skip to content

Commit ae61385

Browse files
committed
Begin v3.10 Release Announcement.
1 parent 377ca06 commit ae61385

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

docs/community/3.10-announcement.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
# Django REST framework 3.10
3+
4+
5+
* Reworked OpenAPI schema generation.
6+
* Python 3 only.
7+
8+
9+
## OpenAPI Schema Generation.
10+
11+
Since we first introduced schema support in Django REST Framework 3.5, OpenAPI has emerged as the widely adopted standard for modelling Web APIs.
12+
13+
This release deprecates the old CoreAPI based schema generation, and introduces improved OpenAPI schema generation in its place.
14+
15+
----
16+
17+
**Switching mode between `CoreAPI` and `OpenAPI`**
18+
19+
Both the `generateschema` management command and `get_schema_view()` helper
20+
function will automatically switch between `CoreAPI` and `OpenAPI` modes,
21+
depending on the value of `api_settings.DEFAULT_SCHEMA_CLASS`.
22+
23+
If `api_settings.DEFAULT_SCHEMA_CLASS` is a subclass of
24+
`rest_framework.schemas.coreapi.AutoSchema` then `CoreAPI` mode will be
25+
selected. Otherwise the new `OpenAPI` will apply.
26+
27+
This means that, unless you previously overrode
28+
`api_settings.DEFAULT_SCHEMA_CLASS`, you automatically be opted-in to the new
29+
`OpenAPI` based schemas.
30+
31+
You can continue to use CoreAPI schemas by setting the appropriate default
32+
schema class:
33+
34+
```python
35+
# In settings.py
36+
REST_FRAMEWORK = {
37+
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
38+
}
39+
```
40+
41+
----
42+
43+
### Quickstart
44+
45+
To get going with `OpenAPI` schemas, use the `get_schema_view()` shortcut.
46+
47+
In your `urls.py`:
48+
49+
```python
50+
from rest_framework.schemas import get_schema_view()
51+
52+
urlpatterns = [
53+
# ...
54+
# Use the `get_schema_view()` helper to add a `SchemaView` to project URLs.
55+
# * `title` and `description` parameters are passed to `SchemaGenerator`.
56+
# * Provide view name for use with `reverse()`.
57+
path('openapi', get_schema_view(
58+
title="Your Project",
59+
description="API for all things …"
60+
), name='openapi-schema'),
61+
# ...
62+
]
63+
```
64+
65+
See the Schemas documentation for more details.
66+
67+
### Feature Roadmap
68+
69+
For v3.7 (with `CoreAPI`) we tried to anticipate customizations that people
70+
were likely to need. (Introducing `manual_fields` and `ManaualSchema`, for
71+
example.) These were under-utilised. They weren't the right abstractions.
72+
73+
So, for a fresh start with `OpenAPI`, customizing schema generation has two
74+
simple rules:
75+
76+
* Subclass `SchemaGenerator` for schema-level cusomizations.
77+
* Subclass `AutoSchema` for view-level customizations.
78+
79+
We'll wait to see what subclasses people actually come up with, for the
80+
customizations they actually need, before trying to bring that back into the
81+
core framework.
82+
83+
There are two kinds of changes that easily predictable:
84+
85+
* General improvements which fill in gaps in the automatic schema generation.
86+
* More use-case specific adjustments, which adjust the API of `SchemaGenerator`
87+
or `AutoSchema`
88+
89+
We'll aim to bring the first type of change quickly in point releases. For the
90+
second kind we'd like to adopt a slower approach, to make sure we keep the API
91+
simple, and as widely applicable as possible, before we bring in API changes.
92+
93+
We trust that approach makes sense.
94+
95+
### Deprecating CoreAPI Schema Generation.
96+
97+
The in-built docs that were introduced in Django REST Framework v3.5 were built on CoreAPI. These are now deprecated. You may continue to use them but they will be **removed in Django REST Framework v 3.12**.
98+
99+
You should migrate to using the new OpenAPI based schema generation as soon as you can.
100+
101+
We have removed the old documentation for the CoreAPI based schema generation.
102+
You may view the [Legacy CoreAPI documentation here][legacy-core-api-docs].
103+
104+
[legacy-core-api-docs]:https://github.com/encode/django-rest-framework/blob/master/docs/coreapi/index.md

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pages:
6565
- 'Contributing to REST framework': 'community/contributing.md'
6666
- 'Project management': 'community/project-management.md'
6767
- 'Release Notes': 'community/release-notes.md'
68+
- '3.10 Announcement': 'community/3.10-announcement.md'
6869
- '3.9 Announcement': 'community/3.9-announcement.md'
6970
- '3.8 Announcement': 'community/3.8-announcement.md'
7071
- '3.7 Announcement': 'community/3.7-announcement.md'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy