From c7df69ab7703c7ed345a445fe1b16ac52c40f026 Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Mon, 4 Dec 2017 10:52:59 +0100 Subject: [PATCH] Note AutoSchema limitations on bare APIView (#5649) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AutoSchema uses GenericAPIView hooks to introspect. If these are not present it’s results will be limited. Note this. Closes #5121 --- docs/api-guide/schemas.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 2b83e0671..9234212ea 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -167,6 +167,18 @@ appropriate Core API `Link` object for the view, request method and path: (In compiling the schema, `SchemaGenerator` calls `view.schema.get_link()` for each view, allowed method and path.) +--- + +**Note**: For basic `APIView` subclasses, default introspection is essentially +limited to the URL kwarg path parameters. For `GenericAPIView` +subclasses, which includes all the provided class based views, `AutoSchema` will +attempt to introspect serialiser, pagination and filter fields, as well as +provide richer path field descriptions. (The key hooks here are the relevant +`GenericAPIView` attributes and methods: `get_serializer`, `pagination_class`, +`filter_backends` and so on.) + +--- + To customise the `Link` generation you may: * Instantiate `AutoSchema` on your view with the `manual_fields` kwarg: