Skip to content

Bump strawberry-graphql from 0.253.1 to 0.254.0 in /07_uns_graphql#1407

Merged
mkashwin merged 6 commits into
mainfrom
dependabot/pip/07_uns_graphql/strawberry-graphql-0.254.0
Dec 16, 2024
Merged

Bump strawberry-graphql from 0.253.1 to 0.254.0 in /07_uns_graphql#1407
mkashwin merged 6 commits into
mainfrom
dependabot/pip/07_uns_graphql/strawberry-graphql-0.254.0

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github Dec 16, 2024

Bumps strawberry-graphql from 0.253.1 to 0.254.0.

Release notes

Sourced from strawberry-graphql's releases.

🍓 0.254.0

This release adds a new on_ws_connect method to all HTTP view integrations. The method is called when a graphql-transport-ws or graphql-ws connection is established and can be used to customize the connection acknowledgment behavior.

This is particularly useful for authentication, authorization, and sending a custom acknowledgment payload to clients when a connection is accepted. For example:

class MyGraphQLView(GraphQLView):
    async def on_ws_connect(self, context: Dict[str, object]):
        connection_params = context["connection_params"]
    if not isinstance(connection_params, dict):
        # Reject without a custom graphql-ws error payload
        raise ConnectionRejectionError()
if connection_params.get("password") != "secret:
    # Reject with a custom graphql-ws error payload
    raise ConnectionRejectionError({"reason": "Invalid password"})

if username := connection_params.get("username"):
    # Accept with a custom acknowledgement payload
    return {"message": f"Hello, {username}!"}

# Accept without a acknowledgement payload
return await super().on_ws_connect(context)

Take a look at our documentation to learn more.

Releases contributed by @​DoctorJohn via #3720

Changelog

Sourced from strawberry-graphql's changelog.

0.254.0 - 2024-12-13

This release adds a new on_ws_connect method to all HTTP view integrations. The method is called when a graphql-transport-ws or graphql-ws connection is established and can be used to customize the connection acknowledgment behavior.

This is particularly useful for authentication, authorization, and sending a custom acknowledgment payload to clients when a connection is accepted. For example:

class MyGraphQLView(GraphQLView):
    async def on_ws_connect(self, context: Dict[str, object]):
        connection_params = context["connection_params"]
    if not isinstance(connection_params, dict):
        # Reject without a custom graphql-ws error payload
        raise ConnectionRejectionError()
if connection_params.get("password") != "secret:
    # Reject with a custom graphql-ws error payload
    raise ConnectionRejectionError({"reason": "Invalid password"})

if username := connection_params.get("username"):
    # Accept with a custom acknowledgement payload
    return {"message": f"Hello, {username}!"}

# Accept without a acknowledgement payload
return await super().on_ws_connect(context)

Take a look at our documentation to learn more.

Contributed by Jonathan Ehwald via [PR #3720](strawberry-graphql/strawberry#3720)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Dec 16, 2024
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Dec 16, 2024

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@dependabot dependabot Bot force-pushed the dependabot/pip/07_uns_graphql/strawberry-graphql-0.254.0 branch from deb6e2c to cc22c3a Compare December 16, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant