-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor schema generation to allow per-view customisation (#5354)
* Initial Refactor Step * Add descriptor class * call from generator * proxy back to generator for implementation. * Move `get_link` to descriptor * Move `get_description` to descriptor * Remove need for generator in get_description * Move get_path_fields to descriptor * Move `get_serializer_fields` to descriptor * Move `get_pagination_fields` to descriptor * Move `get_filter_fields` to descriptor * Move `get_encoding` to descriptor. * Pass just `url` from SchemaGenerator to descriptor * Make `view` a property Encapsulates check for a view instance. * Adjust API Reference docs * Add `ManualSchema` class * Refactor to `ViewInspector` plus `AutoSchema` The interface then is **just** `get_link()` * Add `manual_fields` kwarg to AutoSchema * Add schema decorator for FBVs * Adjust comments * Docs: Provide full params in example Ref feedback https://github.com/encode/django-rest-framework/pull/5354/files/b52e372f8f936204753b17fe7c9bfb517b93a045#r137254795 * Add docstring for ViewInstpector.__get__ descriptor method. Ref #5354 (comment) * Make `schemas` a package. * Split generators, inspectors, views. * Adjust imports * Rename to EndpointEnumerator * Adjust ManualSchema to take `fields` … and `description`. Allows `url` and `action` to remain dynamic * Add package/module docstrings
- Loading branch information
1 parent
5ea810d
commit d54df8c
Showing
12 changed files
with
867 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.