Zaid-Ajaj / Snowflaqe

A dotnet CLI to generate type-safe GraphQL clients for F# and Fable with automatic deserialization, static query verification and type checking
MIT License
154 stars 25 forks source link

Extensions of a response #65

Open FlavDumi opened 2 years ago

FlavDumi commented 2 years ago

Can you make the GraphqlSuccessResponse have the extensions of a response? It only has the data so far. In our case we need to read the extensions to know how much quota we still have available for the API.

image

Zaid-Ajaj commented 2 years ago

Hi there @FlavDumi, I understand the problem but the solution is not as straightforward I am afraid. Mainly because the shape of extensions is not part of the GraphQL schema (if I am not mistaken) so you would have to provide the shape in the configuration JSON like we do with the custom error type. Then we would have to extend the codegen module to also return Result<Query * ExtensionsType, ErrorType list> where ExtensionsType is the configured type from the JSON.

Is this something you would like to give a try and implement?