Skip to content

[client] Allow Automatic Persisted Queries #1640

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

Closed
samuelAndalon opened this issue Jan 17, 2023 · 5 comments
Closed

[client] Allow Automatic Persisted Queries #1640

samuelAndalon opened this issue Jan 17, 2023 · 5 comments
Labels
changes: minor Changes require a minor version module: client Issue affects the client code type: enhancement New feature or request
Milestone

Comments

@samuelAndalon
Copy link
Contributor

Is your feature request related to a problem? Please describe.
graphql-kotlin-server recently added Automatic Persisted Queries to allow clients to send a hash representation of a graphQL operation instead of the actual query string.

Describe the solution you'd like
Allow graphql-kotlin-client to implement APQ requests

@samuelAndalon samuelAndalon added the type: enhancement New feature or request label Jan 17, 2023
@samuelAndalon samuelAndalon added this to the 7.0.0 milestone Jan 17, 2023
@samuelAndalon samuelAndalon added module: client Issue affects the client code changes: minor Changes require a minor version labels Jan 17, 2023
@gumimin
Copy link
Contributor

gumimin commented Mar 12, 2023

Hi @samuelAndalon
I am thinking of implementing this Issue.
Please let me know your implementation plan if you don't mind.

  1. Is the scope of this Issue to add an interface to graphql-kotlin-client? (is it unnecessary to add implementations to graphql-kotlin-ktor-client and graphql-kotlin-spring-client?)

  2. Is it correct to the modifications are as follows.

Add AutomaticallyPersistedQueriesSettings to com.expediagroup.graphql.client.types

interface AutomaticPersistedQueriesSettings<T : Any> {
    val enabled: Boolean
    val httpMethodForHashedQueries: T
    val httpMethodForDocumentQueries: T

Add the automaticPersistedQueriesSettings property to com.expediagroup.graphql.client.GraphQLClient

interface GraphQLClient<RequestCustomizer> {
    val automaticPersistedQueriesSettings: AutomaticPersistedQueriesSettings<*>
    ...
}

Add the extensions property to com.expediagroup.graphql.client.types.GraphQLClientRequest

interface GraphQLClientRequest<T : Any> {
    ...
    val extensions: Any?
        get() = null
    ...
}

@samuelAndalon
Copy link
Contributor Author

Hello, the plan is to enable this from a flag, i think thats the only thing we can let clients to configure, regarding the hash, it has to be sha256 and pretty much follow this pattern

https://opensource.expediagroup.com/graphql-kotlin/docs/server/automatic-persisted-queries/

@gumimin
Copy link
Contributor

gumimin commented Mar 26, 2023

@samuelAndalon
Thank you for your reply.
Is the implementation correct as below? (If the implementation seems correct, I will add a test and make a PR.)
gumimin@b7d9714

@gumimin
Copy link
Contributor

gumimin commented Jun 23, 2023

Hi @samuelAndalon
I made a pull request, could you review it?
#1802

samuelAndalon pushed a commit that referenced this issue Jul 3, 2023
### 📝 Description
- add apq interfaces to client
- add apq implementation to ktor client
- add apq implementation to spring client

### 🔗 Related Issues
#1640
@dariuszkuc
Copy link
Collaborator

Resolved in #1802

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: minor Changes require a minor version module: client Issue affects the client code type: enhancement New feature or request
Development

No branches or pull requests

3 participants