Commit 3b9afb57 by Tom Christie Committed by GitHub

Version 3.5.0 (#4596)

parent 2395fb53
...@@ -344,12 +344,12 @@ Typically you'll instantiate `SchemaGenerator` with a single argument, like so: ...@@ -344,12 +344,12 @@ Typically you'll instantiate `SchemaGenerator` with a single argument, like so:
Arguments: Arguments:
* `title` - The name of the API. **required** * `title` **required** - The name of the API.
* `url` - The root URL of the API schema. This option is not required unless the schema is included under path prefix. * `url` - The root URL of the API schema. This option is not required unless the schema is included under path prefix.
* `patterns` - A list of URLs to inspect when generating the schema. Defaults to the project's URL conf. * `patterns` - A list of URLs to inspect when generating the schema. Defaults to the project's URL conf.
* `urlconf` - A URL conf module name to use when generating the schema. Defaults to `settings.ROOT_URLCONF`. * `urlconf` - A URL conf module name to use when generating the schema. Defaults to `settings.ROOT_URLCONF`.
### get_schema() ### get_schema(self, request)
Returns a `coreapi.Document` instance that represents the API schema. Returns a `coreapi.Document` instance that represents the API schema.
...@@ -359,9 +359,48 @@ Returns a `coreapi.Document` instance that represents the API schema. ...@@ -359,9 +359,48 @@ Returns a `coreapi.Document` instance that represents the API schema.
generator = schemas.SchemaGenerator(title='Bookings API') generator = schemas.SchemaGenerator(title='Bookings API')
return Response(generator.get_schema()) return Response(generator.get_schema())
Arguments: The `request` argument is optional, and may be used if you want to apply per-user
permissions to the resulting schema generation.
### get_links(self, request)
Return a nested dictionary containing all the links that should be included in the API schema.
This is a good point to override if you want to modify the resulting structure of the generated schema,
as you can build a new dictionary with a different layout.
### get_link(self, path, method, view)
Returns a `coreapi.Link` instance corresponding to the given view.
You can override this if you need to provide custom behaviors for particular views.
### get_description(self, path, method, view)
Returns a string to use as the link description. By default this is based on the
view docstring as described in the "Schemas as Documentation" section above.
### get_encoding(self, path, method, view)
Returns a string to indicate the encoding for any request body, when interacting
with the given view. Eg. `'application/json'`. May return a blank string for views
that do not expect a request body.
### get_path_fields(self, path, method, view):
Return a list of `coreapi.Link()` instances. One for each path parameter in the URL.
### get_serializer_fields(self, path, method, view)
Return a list of `coreapi.Link()` instances. One for each field in the serializer class used by the view.
### get_pagination_fields(self, path, method, view
Return a list of `coreapi.Link()` instances, as returned by the `get_schema_fields()` method on any pagination class used by the view.
### get_filter_fields(self, path, method, view)
* `request` - The incoming request. Optionally used if you want to apply per-user permissions to the schema-generation. Return a list of `coreapi.Link()` instances, as returned by the `get_schema_fields()` method of any filter classes used by the view.
--- ---
......
...@@ -194,6 +194,7 @@ directly. ...@@ -194,6 +194,7 @@ directly.
client = RequestsClient() client = RequestsClient()
response = client.get('http://testserver/users/') response = client.get('http://testserver/users/')
assert response.status_code == 200
Note that the requests client requires you to pass fully qualified URLs. Note that the requests client requires you to pass fully qualified URLs.
...@@ -251,9 +252,8 @@ The CoreAPIClient allows you to interact with your API using the Python ...@@ -251,9 +252,8 @@ The CoreAPIClient allows you to interact with your API using the Python
`coreapi` client library. `coreapi` client library.
# Fetch the API schema # Fetch the API schema
url = reverse('schema')
client = CoreAPIClient() client = CoreAPIClient()
schema = client.get(url) schema = client.get('http://testserver/schema/')
# Create a new organisation # Create a new organisation
params = {'name': 'MegaCorp', 'status': 'active'} params = {'name': 'MegaCorp', 'status': 'active'}
......
...@@ -244,6 +244,7 @@ General guides to using REST framework. ...@@ -244,6 +244,7 @@ General guides to using REST framework.
* [3.2 Announcement][3.2-announcement] * [3.2 Announcement][3.2-announcement]
* [3.3 Announcement][3.3-announcement] * [3.3 Announcement][3.3-announcement]
* [3.4 Announcement][3.4-announcement] * [3.4 Announcement][3.4-announcement]
* [3.5 Announcement][3.5-announcement]
* [Kickstarter Announcement][kickstarter-announcement] * [Kickstarter Announcement][kickstarter-announcement]
* [Mozilla Grant][mozilla-grant] * [Mozilla Grant][mozilla-grant]
* [Funding][funding] * [Funding][funding]
...@@ -370,6 +371,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -370,6 +371,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
[3.2-announcement]: topics/3.2-announcement.md [3.2-announcement]: topics/3.2-announcement.md
[3.3-announcement]: topics/3.3-announcement.md [3.3-announcement]: topics/3.3-announcement.md
[3.4-announcement]: topics/3.4-announcement.md [3.4-announcement]: topics/3.4-announcement.md
[3.5-announcement]: topics/3.5-announcement.md
[kickstarter-announcement]: topics/kickstarter-announcement.md [kickstarter-announcement]: topics/kickstarter-announcement.md
[mozilla-grant]: topics/mozilla-grant.md [mozilla-grant]: topics/mozilla-grant.md
[funding]: topics/funding.md [funding]: topics/funding.md
......
...@@ -257,7 +257,7 @@ Codecs are responsible for encoding or decoding Documents. ...@@ -257,7 +257,7 @@ Codecs are responsible for encoding or decoding Documents.
The decoding process is used by a client to take a bytestring of an API schema The decoding process is used by a client to take a bytestring of an API schema
definition, and returning the Core API `Document` that represents that interface. definition, and returning the Core API `Document` that represents that interface.
A codec should be associated with a particular media type, such as **TODO**. A codec should be associated with a particular media type, such as `'application/coreapi+json'`.
This media type is used by the server in the response `Content-Type` header, This media type is used by the server in the response `Content-Type` header,
in order to indicate what kind of data is being returned in the response. in order to indicate what kind of data is being returned in the response.
......
...@@ -38,6 +38,14 @@ You can determine your currently installed version using `pip freeze`: ...@@ -38,6 +38,14 @@ You can determine your currently installed version using `pip freeze`:
--- ---
## 3.5.x series
### 3.5.0
**Date**: [20th October 2016][3.5.0-milestone]
---
## 3.4.x series ## 3.4.x series
### 3.4.7 ### 3.4.7
...@@ -596,6 +604,7 @@ For older release notes, [please see the version 2.x documentation][old-release- ...@@ -596,6 +604,7 @@ For older release notes, [please see the version 2.x documentation][old-release-
[3.4.5-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.5+Release%22 [3.4.5-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.5+Release%22
[3.4.6-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.6+Release%22 [3.4.6-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.6+Release%22
[3.4.7-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.7+Release%22 [3.4.7-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.4.7+Release%22
[3.5.0-milestone]: https://github.com/tomchristie/django-rest-framework/issues?q=milestone%3A%223.5.0+Release%22
<!-- 3.0.1 --> <!-- 3.0.1 -->
[gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013 [gh2013]: https://github.com/tomchristie/django-rest-framework/issues/2013
......
...@@ -66,6 +66,7 @@ pages: ...@@ -66,6 +66,7 @@ pages:
- '3.2 Announcement': 'topics/3.2-announcement.md' - '3.2 Announcement': 'topics/3.2-announcement.md'
- '3.3 Announcement': 'topics/3.3-announcement.md' - '3.3 Announcement': 'topics/3.3-announcement.md'
- '3.4 Announcement': 'topics/3.4-announcement.md' - '3.4 Announcement': 'topics/3.4-announcement.md'
- '3.5 Announcement': 'topics/3.5-announcement.md'
- 'Kickstarter Announcement': 'topics/kickstarter-announcement.md' - 'Kickstarter Announcement': 'topics/kickstarter-announcement.md'
- 'Mozilla Grant': 'topics/mozilla-grant.md' - 'Mozilla Grant': 'topics/mozilla-grant.md'
- 'Funding': 'topics/funding.md' - 'Funding': 'topics/funding.md'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment