strawberry-graphql / strawberry

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

Updated schema-configurations.md to correct the last code example #3651

Closed topher-g closed 1 month ago

topher-g commented 1 month ago

Description

Updated schema-configurations.md to correct the following code example:

class CustomInfo(Info):
    @property
    def response_headers(self) -> Headers:
        return self.context["response"].headers

schema = strawberry.Schema(query=Query, info_class=CustomInfo)

to correctly use StrawberryConfig as follows:

class CustomInfo(Info):
    @property
    def response_headers(self) -> Headers:
        return self.context["response"].headers

schema = strawberry.Schema(query=Query, config=StrawberryConfig(info_class=CustomInfo))

Types of Changes

Issues Fixed or Closed by This PR

Checklist

Summary by Sourcery

Update the schema-configurations.md documentation to correct the code example by using StrawberryConfig for the info_class parameter.

Documentation:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This pull request updates the documentation in the schema-configurations.md file to correct a code example. The change demonstrates the proper use of StrawberryConfig when configuring a custom Info class in a Strawberry schema.

No sequence diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Updated code example to use StrawberryConfig for configuring custom Info class
  • Replaced direct assignment of info_class with StrawberryConfig
  • Added config parameter to strawberry.Schema constructor
  • Wrapped CustomInfo class in StrawberryConfig
docs/types/schema-configurations.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. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
botberry commented 1 month ago

Thanks for contributing to Strawberry! 🎉 You've been invited to join the Strawberry GraphQL organisation 😊

You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67

And don't forget to join our discord server: https://strawberry.rocks/discord 🔥