strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
3.95k stars 525 forks source link

Fix missing return annotation in get_customer docs #3642

Closed Skeen closed 1 week ago

Skeen commented 1 week ago

Description

The example under: "Defining extra types when using Interfaces" on https://strawberry.rocks/docs/types/schema contains an example, which does not run.

Using the documentation as-is produces this error:

MissingReturnAnnotationError: Return annotation missing for field "get_customer", did you forget to add it?

Types of Changes

Issues Fixed or Closed by This PR

*

Checklist

Summary by Sourcery

Correct the return annotation in the 'get_customer' function example in the documentation to prevent runtime errors and improve clarity.

Documentation:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This pull request fixes a missing return annotation in the documentation example for the get_customer method. The change addresses an error that users would encounter when trying to run the example as-is from the documentation.

File-Level Changes

Change Details Files
Added missing return annotation to the get_customer method example
  • Added -> Customer as the return type annotation for the get_customer method
  • Removed the commented-out return type annotation
docs/types/schema.md

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.