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

Doesn’t conform to protocol when build with Apollo pod 0.9.0 #305

Closed
mintpark opened this issue Jun 29, 2018 · 9 comments
Closed

Doesn’t conform to protocol when build with Apollo pod 0.9.0 #305

mintpark opened this issue Jun 29, 2018 · 9 comments

Comments

@mintpark
Copy link

2018-06-29 11 11 58

When I update pod 0.8.0 to 0.9.0, models generated by code-gen needs property resultMap. But the code-gen doesn’t automatically add resultMap, even build fails.
To resolve this problem, I tried to add resultMap one by one to every module in API.swift. However it requires advanced initializers which considers resultMap and established properties like rawValue.
If 0.9.0 needs extra handling, please leave comments.

@martijnwalraven
Copy link
Contributor

What version of apollo-codegen are you running? If you use the recommended build script, it should install the right version for the version of the Apollo framework installed in your project automatically.

@dockay
Copy link

dockay commented Jul 10, 2018

@martijnwalraven the script was renamed from check-and-run-apollo-cli.sh to check-and-run-apollo-codegen.sh. Thats not documented anywhere.

@dockay
Copy link

dockay commented Jul 10, 2018

Leaves the script error:

exec apollo-codegen codegen:generate '--queries=./API/graphql/GetAppointments.graphql
./API/graphql/UpdateAppointment.graphql
./API/graphql/UpdateUserPassword.graphql
./API/graphql/DeleteAppointment.graphql
./API/graphql/CreateAppointment.graphql
./API/graphql/GetCustomers.graphql
./API/graphql/DeleteCustomer.graphql
./API/graphql/CreateCustomer.graphql
./API/graphql/UpdateCustomer.graphql
./API/graphql/Viewer.graphql
./API/graphql/UpdateViewerPassword.graphql
./API/graphql/PasswordReset.graphql' --schema=schema.json API.swift
error: Unknown arguments: queries, schema, codegen:generate, API.swift

apollo-codegen is 0.20.2

@dockay
Copy link

dockay commented Jul 10, 2018

Editing the script check-and-run-apollo-codegen.sh Line 73 from exec apollo-codegen "$@" to exec apollo "$@" does the trick.

@GuelorEmanuel
Copy link

As @dockay said there's a bit of conflict with the naming check-and-run-apollo-cli.sh to check-and-run-apollo-codegen.sh, should't this be a priority since it's going to lead a lot of people astray?
Also @dockay changing the xec apollo-codegen "$@" to exec apollo "$@" doesn't do the trick for me.

@martijnwalraven
Copy link
Contributor

Since apollo-codegen is now part of the new apollo-cli, the build script used to generate API.swift needs to be updated. See the docs for the updated script.

@GuelorEmanuel
Copy link

GuelorEmanuel commented Jul 29, 2018

@martijnwalraven Managed to figure it out, thank you!

@dockay
Copy link

dockay commented Jul 30, 2018

actually we fixed it with the new build script @martijnwalraven mentioned, but we also did this:
sudo chown -R $(whoami) /usr/local/lib/node_modules/ in terminal, in this way the script can install itself what it needs, this also removes some "newer/older version conflict" errors.

@designatednerd
Copy link
Contributor

Going to close this one out - current build steps can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants