Skip to content

Commit 4d57cd3

Browse files
ajyongcarltongibson
authored andcommitted
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.
1 parent 64f567a commit 4d57cd3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

docs/api-guide/schemas.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ The `get_schema_view()` helper takes the following keyword arguments:
115115
* `renderer_classes`: May be used to pass the set of renderer classes that can
116116
be used to render the API root endpoint.
117117

118-
119118
## Customizing Schema Generation
120119

121120
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:
155154
The `request` argument is optional, and may be used if you want to apply
156155
per-user permissions to the resulting schema generation.
157156

158-
This is a good point to override if you want to customise the generated
157+
This is a good point to override if you want to customize the generated
159158
dictionary, for example to add custom
160159
[specification extensions][openapi-specification-extensions].
161160

@@ -184,14 +183,13 @@ provide richer path field descriptions. (The key hooks here are the relevant
184183

185184
---
186185

187-
In order to customise the operation generation, you should provide an `AutoSchema` subclass, overriding `get_operation()` as you need:
188-
186+
In order to customize the operation generation, you should provide an `AutoSchema` subclass, overriding `get_operation()` as you need:
189187

190188
from rest_framework.views import APIView
191189
from rest_framework.schemas.openapi import AutoSchema
192190

193191
class CustomSchema(AutoSchema):
194-
def get_link(...):
192+
def get_operation(...):
195193
# Implement custom introspection here (or in other sub-methods)
196194

197195
class CustomView(APIView):
@@ -219,4 +217,4 @@ project you may adjust `settings.DEFAULT_SCHEMA_CLASS` appropriately.
219217

220218
[openapi]: https://github.com/OAI/OpenAPI-Specification
221219
[openapi-specification-extensions]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#specification-extensions
222-
[openapi-operation]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject
220+
[openapi-operation]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#operationObject

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