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

Extend query documentation #3390

Merged
merged 3 commits into from
Feb 25, 2024

Conversation

ThirVondukr
Copy link
Contributor

Extends query documentation, adding examples with using decorator, arguments and strawberry.argument

Description

Types of Changes

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

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

Add examples with using decorator, arguments and `strawberry.argument`
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.

We have skipped reviewing this pull request. All the files appear to be documentation files, which we're not great at reviewing... yet!

docs/general/queries.md Outdated Show resolved Hide resolved
Copy link
Member

@DoctorJohn DoctorJohn left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @ThirVondukr, LGTM :)

Co-authored-by: Jonathan Ehwald <github@ehwald.info>
Comment on lines +95 to +96
deprecation_reason="isTasty argument is deprecated, "
"use fruits(taste:SWEET) instead",

Choose a reason for hiding this comment

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

How about 🤔

Suggested change
deprecation_reason="isTasty argument is deprecated, "
"use fruits(taste:SWEET) instead",
deprecation_reason="isTasty argument is deprecated, use fruits(taste:SWEET) instead",

@strawberry.type
class Query:
    @strawberry.field
    def fruits(
        self,
        is_tasty: Annotated[
            bool | None,
            strawberry.argument(
                description="Filters out fruits by whenever they're tasty or not",
                deprecation_reason="isTasty argument is deprecated, "
                "use fruits(taste:SWEET) instead",
            ),
        ] = None,
    ) -> list[str]: ...

@strawberry.type
class Query:
    @strawberry.field
    def fruits(
        self,
        is_tasty: Annotated[
            bool | None,
            strawberry.argument(
                description="Filters out fruits by whenever they're tasty or not",
                deprecation_reason="isTasty argument is deprecated, use fruits(taste:SWEET) instead",
            ),
        ] = None,
    ) -> list[str]: ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This it a bit too long (101) characters, it's hard to read in git diffs, and black by default recommends 88-80 character limit

@DoctorJohn DoctorJohn merged commit 3709858 into strawberry-graphql:main Feb 25, 2024
4 checks passed
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.

None yet

3 participants