Expand my Community achievements bar.

SOLVED

Can we version graphql query

Avatar

Level 1

Is there any way we can version the graphql persisted queries.

1 Accepted Solution

Avatar

Correct answer by
Level 8

Persisted queries url gets cached. So versioning of query is creating new url, not available in cache. Currently in our project, we duplicate the queries to v2 like this 

sarav_prakash_0-1737400770373.png

This way old clients will continue using v1 version and new clients can switch to v2. 

 

Remember, non-breaking changes, like adding new fields, dont require versioning. Since clients would simply ignore new field. But breaking changes, like changing modal, removing fields, changing filters etc, will break existing clients and has to be versioned. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 8

Persisted queries url gets cached. So versioning of query is creating new url, not available in cache. Currently in our project, we duplicate the queries to v2 like this 

sarav_prakash_0-1737400770373.png

This way old clients will continue using v1 version and new clients can switch to v2. 

 

Remember, non-breaking changes, like adding new fields, dont require versioning. Since clients would simply ignore new field. But breaking changes, like changing modal, removing fields, changing filters etc, will break existing clients and has to be versioned.