Skip to content
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

Support for @client directive and local only fields #2611

Open
RageshAntony opened this issue Sep 27, 2020 · 4 comments
Open

Support for @client directive and local only fields #2611

RageshAntony opened this issue Sep 27, 2020 · 4 comments

Comments

@RageshAntony
Copy link

Is your feature request related to a problem? Please describe.
Need to add a custom variable in generated class that not in Query

Describe the solution you'd like
I need to add some custom variables in generated class that not present in Query file. That is , i need a boolean isExpanded variable in generated class for a query , that not included in query field.(for programming only usage)

Is that possible ?

@martinbonnin
Copy link
Contributor

Hi 👋 , this is not possible. If you want to attach some data to a generated model, you can write a wrapper class that will add data.

@martinbonnin
Copy link
Contributor

@RageshAntony can you detail why wrapping the generated model to add your data is not a good solution in your case? I'm trying to see if @client directive and web-like local only fields could add value there. I'm not really sure how that would work with Kotlin but it might be something worth exploring.

@RageshAntony
Copy link
Author

@RageshAntony can you detail why wrapping the generated model to add your data is not a good solution in your case? I'm trying to see if @client directive and web-like local only fields could add value there. I'm not really sure how that would work with Kotlin but it might be something worth exploring.

Yeah I tried isExpanded @client in gql file in Android project and when building, apollo throwing error .

Ok I wrap inside an another class like you suggested . No problem

And one suggestion

These local fields (@ client) is an awesome feature . Please try to support them in Apollo-Android code generation

Thank You

@martinbonnin martinbonnin changed the title Need to add a custom variable in generated class that not in Query fields Support for @client directive and local only fields Oct 4, 2020
@darylsze
Copy link

darylsze commented Jun 3, 2021

@RageshAntony may i know have you managed to successfully generate models with @client directive used in graphql files? can you share your approach? thanks.

@BoD BoD changed the title Support for @client directive and local only fields Support for @client directive and local only fields Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants