Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring the view extensions docs on par #3711

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DoctorJohn
Copy link
Member

@DoctorJohn DoctorJohn commented Nov 22, 2024

Description

This PR updates the "Extending the view" sections of all integrations.

I made sure all overrideable methods of the base view are documented with the correct types and that all the examples include all required imports to run them.

(The only exception are the Channels docs which I only updated partially. I want to combine the HTTP and WS consumers there first, otherwise the docs will include everything twice).

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Summary by Sourcery

Documentation:

  • Update the 'Extending the view' sections across various integration documentation to ensure all overrideable methods of the base view are documented with correct types and examples are copyable.

Copy link
Contributor

sourcery-ai bot commented Nov 22, 2024

Reviewer's Guide by Sourcery

This PR updates and standardizes the documentation for extending view classes across all integration modules. The changes focus on improving type hints, adding missing extension methods, and ensuring consistency in method signatures and examples.

Updated class diagram for GraphQLController extensions

classDiagram
    class GraphQLController {
        +async process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
        +async render_graphql_ide(request: Request) Response
    }
    class MyGraphQLController {
        +async process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
    }
    GraphQLController <|-- MyGraphQLController
Loading

Updated class diagram for GraphQLView extensions

classDiagram
    class GraphQLView {
        +get_context(request: Request, response: Response) Context
        +get_root_value(request: Request) Optional[RootValue]
        +process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
        +render_graphql_ide(request: Request) Response
    }
    class MyGraphQLView {
        +get_context(request: Request, response: Response) Context
        +get_root_value(request: Request) Optional[RootValue]
        +process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
    }
    GraphQLView <|-- MyGraphQLView
Loading

Updated class diagram for GraphQLRouter extensions

classDiagram
    class GraphQLRouter {
        +async process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
        +async render_graphql_ide(request: Request) HTMLResponse
    }
    class MyGraphQLRouter {
        +async process_result(request: Request, result: ExecutionResult) GraphQLHTTPResponse
        +decode_json(data: Union[str, bytes]) object
        +encode_json(data: object) str
    }
    GraphQLRouter <|-- MyGraphQLRouter
Loading

File-Level Changes

Change Details Files
Added and standardized JSON encoding/decoding extension methods documentation
  • Added decode_json method documentation with examples using orjson
  • Added encode_json method documentation with examples using json.dumps
  • Standardized method signatures and return types across all integrations
docs/integrations/litestar.md
docs/integrations/django.md
docs/integrations/flask.md
docs/integrations/asgi.md
docs/integrations/aiohttp.md
docs/integrations/chalice.md
docs/integrations/quart.md
docs/integrations/sanic.md
docs/integrations/channels.md
docs/integrations/fastapi.md
Improved type hints and method signatures for view extension methods
  • Updated get_context method signatures with proper Context type
  • Updated get_root_value method signatures with Optional[RootValue] return type
  • Added proper type hints for request and response parameters
  • Standardized method signatures across all integration modules
docs/integrations/litestar.md
docs/integrations/django.md
docs/integrations/flask.md
docs/integrations/asgi.md
docs/integrations/aiohttp.md
docs/integrations/chalice.md
docs/integrations/quart.md
docs/integrations/sanic.md
docs/integrations/channels.md
docs/integrations/fastapi.md
Added complete code examples with proper imports
  • Added missing imports in code examples
  • Updated examples to use proper types and parameters
  • Made examples consistent across all integration modules
docs/integrations/litestar.md
docs/integrations/django.md
docs/integrations/flask.md
docs/integrations/asgi.md
docs/integrations/aiohttp.md
docs/integrations/chalice.md
docs/integrations/quart.md
docs/integrations/sanic.md
docs/integrations/channels.md
docs/integrations/fastapi.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DoctorJohn - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

docs/integrations/channels.md Show resolved Hide resolved
docs/integrations/quart.md Show resolved Hide resolved
@DoctorJohn DoctorJohn force-pushed the bring-the-view-extension-docs-on-par branch from 80ef416 to b0f74c6 Compare November 22, 2024 20:53
@DoctorJohn DoctorJohn changed the title Bring the view extensions docs on-par Bring the view extensions docs on par Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant