From 4d57cd31f64dcfa71958a77d7adffd7a87e16e9b Mon Sep 17 00:00:00 2001 From: Aaron Yong Date: Thu, 24 Oct 2019 00:54:37 -0600 Subject: [PATCH] Update method override example in Schemas docs (#6887) (#7013) get_link() was a method in the old CoreAPI-based AutoSchema implementation. The new OpenAPI one defines get_operation() instead: the example code block was overlooked. --- docs/api-guide/schemas.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 76cc0ca4d..de12ba517 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -115,7 +115,6 @@ The `get_schema_view()` helper takes the following keyword arguments: * `renderer_classes`: May be used to pass the set of renderer classes that can be used to render the API root endpoint. - ## Customizing Schema Generation You may customize schema generation at the level of the schema as a whole, or @@ -155,7 +154,7 @@ Returns a dictionary that represents the OpenAPI schema: The `request` argument is optional, and may be used if you want to apply per-user permissions to the resulting schema generation. -This is a good point to override if you want to customise the generated +This is a good point to override if you want to customize the generated dictionary, for example to add custom [specification extensions][openapi-specification-extensions]. @@ -184,14 +183,13 @@ provide richer path field descriptions. (The key hooks here are the relevant --- -In order to customise the operation generation, you should provide an `AutoSchema` subclass, overriding `get_operation()` as you need: - +In order to customize the operation generation, you should provide an `AutoSchema` subclass, overriding `get_operation()` as you need: from rest_framework.views import APIView from rest_framework.schemas.openapi import AutoSchema class CustomSchema(AutoSchema): - def get_link(...): + def get_operation(...): # Implement custom introspection here (or in other sub-methods) class CustomView(APIView): @@ -219,4 +217,4 @@ project you may adjust `settings.DEFAULT_SCHEMA_CLASS` appropriately. [openapi]: https://github.com/OAI/OpenAPI-Specification [openapi-specification-extensions]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specification-extensions -[openapi-operation]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject \ No newline at end of file +[openapi-operation]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject