Debian Codegraph @

docs/community/3.10-announcement.md

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <style>
2 .promo li a {
3 float: left;
4 width: 130px;
5 height: 20px;
6 text-align: center;
7 margin: 10px 30px;
8 padding: 150px 0 0 0;
9 background-position: 0 50%;
10 background-size: 130px auto;
11 background-repeat: no-repeat;
12 font-size: 120%;
13 color: black;
14 }
15 .promo li {
16 list-style: none;
17 }
18 </style>
19
20 # Django REST framework 3.10
21
22 The 3.10 release drops support for Python 2.
23
24 * Our supported Python versions are now: 3.5, 3.6, and 3.7.
25 * Our supported Django versions are now: 1.11, 2.0, 2.1, and 2.2.
26
27 ## OpenAPI Schema Generation
28
29 Since we first introduced schema support in Django REST Framework 3.5, OpenAPI has emerged as the widely adopted standard for modeling Web APIs.
30
31 This release begins the deprecation process for the CoreAPI based schema generation, and introduces OpenAPI schema generation in its place.
32
33 ---
34
35 ## Continuing to use CoreAPI
36
37 If you're currently using the CoreAPI schemas, you'll need to make sure to
38 update your REST framework settings to include `DEFAULT_SCHEMA_CLASS` explicitly.
39
40 **settings.py**:
41
42 ```python
43 REST_FRAMEWORK = {
44 ...: ...,
45 "DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
46 }
47 ```
48
49 You'll still be able to keep using CoreAPI schemas, API docs, and client for the
50 foreseeable future. We'll aim to ensure that the CoreAPI schema generator remains
51 available as a third party package, even once it has eventually been removed
52 from REST framework, scheduled for version 3.12.
53
54 We have removed the old documentation for the CoreAPI based schema generation.
55 You may view the [Legacy CoreAPI documentation here][legacy-core-api-docs].
56
57 ----
58
59 ## OpenAPI Quickstart
60
61 You can generate a static OpenAPI schema, using the `generateschema` management
62 command.
63
64 Alternately, to have the project serve an API schema, use the `get_schema_view()`
65 shortcut.
66
67 In your `urls.py`:
68
69 ```python
70 from rest_framework.schemas import get_schema_view
71
72 urlpatterns = [
73 # ...
74 # Use the `get_schema_view()` helper to add a `SchemaView` to project URLs.
75 # * `title` and `description` parameters are passed to `SchemaGenerator`.
76 # * Provide view name for use with `reverse()`.
77 path(
78 "openapi",
79 get_schema_view(title="Your Project", description="API for all things …"),
80 name="openapi-schema",
81 ),
82 # ...
83 ]
84 ```
85
86 ### Customization
87
88 For customizations that you want to apply across the entire API, you can subclass `rest_framework.schemas.openapi.SchemaGenerator` and provide it as an argument
89 to the `generateschema` command or `get_schema_view()` helper function.
90
91 For specific per-view customizations, you can subclass `AutoSchema`,
92 making sure to set `schema = <YourCustomClass>` on the view.
93
94 For more details, see the [API Schema documentation](../api-guide/schemas.md).
95
96 ### API Documentation
97
98 There are some great third party options for documenting your API, based on the
99 OpenAPI schema.
100
101 See the [Documenting you API](../topics/documenting-your-api.md) section for more details.
102
103 ---
104
105 ## Feature Roadmap
106
107 Given that our OpenAPI schema generation is a new feature, it's likely that there
108 will still be some iterative improvements for us to make. There will be two
109 main cases here:
110
111 * Expanding the supported range of OpenAPI schemas that are generated by default.
112 * Improving the ability for developers to customize the output.
113
114 We'll aim to bring the first type of change quickly in point releases. For the
115 second kind we'd like to adopt a slower approach, to make sure we keep the API
116 simple, and as widely applicable as possible, before we bring in API changes.
117
118 It's also possible that we'll end up implementing API documentation and API client
119 tooling that are driven by the OpenAPI schema. The `apistar` project has a
120 significant amount of work towards this. However, if we do so, we'll plan
121 on keeping any tooling outside of the core framework.
122
123 ---
124
125 ## Funding
126
127 REST framework is a *collaboratively funded project*. If you use
128 REST framework commercially we strongly encourage you to invest in its
129 continued development by **[signing up for a paid plan][funding]**.
130
131 *Every single sign-up helps us make REST framework long-term financially sustainable.*
132
133 <ul class="premium-promo promo">
134 <li><a href="https://getsentry.com/welcome/" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/sentry130.png)">Sentry</a></li>
135 <li><a href="https://getstream.io/try-the-api/?utm_source=drf&utm_medium=banner&utm_campaign=drf" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/stream-130.png)">Stream</a></li>
136 <li><a href="https://software.esg-usa.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/esg-new-logo.png)">ESG</a></li>
137 <li><a href="https://rollbar.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/rollbar2.png)">Rollbar</a></li>
138 <li><a href="https://cadre.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/cadre.png)">Cadre</a></li>
139 <li><a href="https://hubs.ly/H0f30Lf0" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/kloudless-plus-text.png)">Kloudless</a></li>
140 <li><a href="https://lightsonsoftware.com" style="background-image: url(https://fund-rest-framework.s3.amazonaws.com/lightson-dark.png)">Lights On Software</a></li>
141 </ul>
142 <div style="clear: both; padding-bottom: 20px;"></div>
143
144 *Many thanks to all our [wonderful sponsors][sponsors], and in particular to our premium backers, [Sentry](https://getsentry.com/welcome/), [Stream](https://getstream.io/?utm_source=drf&utm_medium=banner&utm_campaign=drf), [ESG](https://software.esg-usa.com/), [Rollbar](https://rollbar.com/?utm_source=django&utm_medium=sponsorship&utm_campaign=freetrial), [Cadre](https://cadre.com), [Kloudless](https://hubs.ly/H0f30Lf0), and [Lights On Software](https://lightsonsoftware.com).*
145
146 [legacy-core-api-docs]:https://github.com/encode/django-rest-framework/blob/3.14.0/docs/coreapi/index.md
147 [sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors
148 [funding]: https://opencollective.com/django-rest-framework