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

Apollo Codegen deprecated #1042

Closed
KennyTsui opened this issue Aug 31, 2018 · 15 comments
Closed

Apollo Codegen deprecated #1042

KennyTsui opened this issue Aug 31, 2018 · 15 comments
Assignees

Comments

@KennyTsui
Copy link

KennyTsui commented Aug 31, 2018

It seems like Apollo Codegen has been deprecated and replaced with Apollo, see:
https://www.npmjs.com/package/apollo-codegen
https://www.npmjs.com/package/apollo

> Task :installApolloCodegen
npm WARN deprecated [email protected]: The 'apollo-codegen' command has been replaced with the more-powerful 'apollo' CLI. Switch to 'apollo' to ensure future updates and visit https://npm.im/apollo#code-generation for more information.

Based on the output, it looks like Apollo Android still uses the deprecated module, are there plans to migrate to Apollo from Apollo Codegen?

Follow up question: If a provided schema.json exists in the appropriate location, is it possible to skip node and apollo-codegen install entirely?

@sav007
Copy link
Contributor

sav007 commented Sep 5, 2018

Yes there is such plan, the only what was blocking us apollographql/rover#537. But seems it fixed now

@anudeep3998
Copy link

Any updates on when this will be released?

@sav007
Copy link
Contributor

sav007 commented Nov 14, 2018

I'm going to look at it right now

@sav007 sav007 self-assigned this Nov 14, 2018
@sav007
Copy link
Contributor

sav007 commented Nov 20, 2018

There are still some issues with Apollo code gen module we are trying to resolve. For now there is no big benefit of migrating to new apollo cli

@drsounds
Copy link

But it doesn't seems to generate any code anymore

@venik
Copy link

venik commented Feb 4, 2019

There is, apparently, a problem with the apollo-tooling:0.19.1
https://github.com/apollographql/apollo-tooling/blob/v0.19.1/package.json

it consumes:
"graphql": "^0.13.1",

The problem we get looks similar to
apollographql/apollo-tooling#630 (comment)

and was fixed with (by updating graphql to version 14):
apollographql/apollo-tooling#624

It would be really nice to move to the latest.

@mirkonasato
Copy link
Contributor

Looks like the Apollo CLI doesn't support generating Java code yet. (As of v2.4.4.) Maybe that's the main issue?

Help for apollo client:codegen:

--target=target (required) Type of code generator to use (swift | typescript | flow | scala), inferred from output

There's a PR: [WIP] add support for java and comment syntax

@venik
Copy link

venik commented Feb 7, 2019

Current Gradle plugin implementation generates JSON from GraphQL files and then uses Moshi
https://github.com/square/moshi
to generate Java code, the problem here is that apollo-tooling has a bug, which was solved, but current apollo-android still points to the old (buggy) apollo-tooling

@mirkonasato
Copy link
Contributor

@venik as far as I can tell Moshi is just a JSON parser, not a code generator. It's used by the Gradle plugin only to parse package.json. The plugin uses apollo-codegen to generate Java code.

@venik
Copy link

venik commented Feb 7, 2019

Well, it generates from

query blocksList {
  blocks {
    blockType
  }
}

something java-like

package com.sample.schemaapollo;
...
@Generated("Apollo GraphQL")
public final class BlocksListQuery implements Query<BlocksListQuery.Data, BlocksListQuery.Data, Operation.Variables> {
  public static final String OPERATION_ID = "bc2856a07ab37724cac77379757113c3e0b46fff849dc03bda9697ba58b3ea3e";

  public static final String QUERY_DOCUMENT = "query blocksList {\n"
      + "  blocks {\n"
      + "    __typename\n"
      + "    blockType\n"
      + "  }\n"
      + "}";

  public static final OperationName OPERATION_NAME = new OperationName() {
    @Override
    public String name() {
      return "blocksList";
    }
  };

  private final Operation.Variables variables;

  public BlocksListQuery() {
    this.variables = Operation.EMPTY_VARIABLES;
  }
  ...

@friederikewild
Copy link

@sav007 Any news on this? Just integrated Apollo into my project and also noticed a build warning that seems to be related to this?

deprecated [email protected]: The 'apollo-codegen' command ahs been replaced with the more-powerful 'apollo' CLI

@ashish-patidar-rau
Copy link

i have a same problem

npm WARN deprecated [email protected]: The 'apollo-codegen' command has been replaced with the more-powerful 'apollo' CLI. Switch to 'apollo' to ensure future updates and visit https://npm.im/apollo#code-generation for more information.

Is any other way to implement Apollo into Android?

@ghadly
Copy link

ghadly commented Aug 16, 2019

Getting the same warning from the CI tool, any news ?

npm WARN deprecated [email protected]: The 'apollo-codegen' command has been replaced with the more-powerful 'apollo' CLI. Switch to 'apollo' to ensure future updates and visit https://npm.im/apollo#code-generation for more information.

@martinbonnin
Copy link
Contributor

apollo-codegen is going away soon: #1482.

You can actually already test this in the 1.0.3-SNAPSHOT version.

@sav007
Copy link
Contributor

sav007 commented Aug 22, 2019

Please try latest version with a new code generation engine https://github.com/apollographql/apollo-android/releases/tag/1.1.0

If you see the same issue pls reopen.

@sav007 sav007 closed this as completed Aug 22, 2019
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

10 participants