Skip to content

feat!: rework extension handling on errors & responses#1130

Open
obmarg wants to merge 1 commit intomainfrom
obmarg/kxrrystskpvu
Open

feat!: rework extension handling on errors & responses#1130
obmarg wants to merge 1 commit intomainfrom
obmarg/kxrrystskpvu

Conversation

@obmarg
Copy link
Owner

@obmarg obmarg commented Feb 17, 2025

Why are we making this change?

GraphQl allows a server to provide arbitrary extensions on responses & errors within a response. Currently cynic only supports decoding these extensions on errors. It does this with generic parameters on the response & error type.

These generic parameters are a little awkward when using the cynic http code - as we need a way to pass through the expected extension types. This led to the addition of a retain_extensions function.

Some users would also like to access extensions on the response itself.

What effects does this change have?

Adds support for extensions on the response type. Rather than adding this as a new generic parameter we now store extensions in a serde_json::Value and provide functionality for deserialising from that. This saves us from adding another generic parameter everywhere, and saves us from having to implement functions like retain_extensions in the http layer.

Fixes #1016

@obmarg obmarg added the breaking A breaking change label Feb 17, 2025
@obmarg obmarg added this to the 4.0.0 milestone Feb 17, 2025
@netlify
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for cynic-querygen-web canceled.

Name Link
🔨 Latest commit ae151c9
🔍 Latest deploy log https://app.netlify.com/sites/cynic-querygen-web/deploys/67b360a763ce330008aff1b9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsing extensions contained in response

1 participant