-
Notifications
You must be signed in to change notification settings - Fork 731
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
How to generate snake_case property name to camelCase in Apollo version 1.0.3 cli auto generate? #2641
Comments
Hi @Spatel91111 👋🏻 - currently the conversion strategy is only for enum cases. It does not work for all properties yet, that is one of the future features we're considering. I'll add this to a future milestone for now. |
In the same area as #2570. |
Hello @calvincestari , is any update on this feature(convert snake_case property name to camelCase)? |
No progress yet, it's scheduled for one of the upcoming releases. We're always happy to accept and review PRs though, thanks. |
Thank you @calvincestari !!! Now one more question : is it possible to generate model with class instead of struct via any configuration? |
@Spatel91111, no these models are immutable and intended to be used as value structs. It provides a lot of performance benefit to use structs here. What reasons do you have for wanting them to be classes? |
@AnthonyMDev thank you for reply. One scenario is that the model object goes beyond 3-4 level screens and the first screen needs to be updated accordingly because the structure object is passed by its value and the object value is not updated in the first screen. |
The returned models are not updated in-place when your data is updated though. That's why they are immutable structs. When you get new data, you get completely new instances of your model objects, which you need to then pass to your views or some view model that can use the new data. Turning the models into classes would not change this. Updating the models in-place would be a major change to the way Apollo works and is not something that is in scope for our current work. We do hope to provide better ways for you to receive updates to your data in a more fine grained way at some point, but I'm not sure what that will look like yet. |
How to generate snake_case property name to camelCase in 1.0.3 cli auto generate?
Configuration in .json file as below:
But generate property in mutation file as below
public var first_name: String { __data["first_name"] }
Need to generate property name like this
public var firstName: String { __data["first_name"] }
is it possible in Apollo 1.0.3 version?
The text was updated successfully, but these errors were encountered: