Apollo-tooling: Error: For TypeScript and Flow generators, "output" must be empty or a single directory name, unless

Created on 13 Sep 2018  Â·  3Comments  Â·  Source: apollographql/apollo-tooling

I am able to create schema.json with below command

apollo schema:download --endpoint http://localhost:4000 schema.json

I have directory structure as below

package.json
schema.json
src
    queries.js
    mutations.js

My graphql queries and mutations are stored in queries.js and mutations.js. when I run the below command I get an error. I have tried several variations but nothing works.

apollo codegen:generate --schema schema.json --target flow --queries src/*.js

Error:

 ›   Error: For TypeScript and Flow generators, "output" must be empty or a single directory name, unless 
 ›   the "outputFlat" flag is set.
has-reproduction

Most helpful comment

That exact command yields the same error for me. Attempting to provide the "output" parameter per the documentation:

apollo codegen:generate --queries="./src/**/*.ts" --schema=./schema.json --target=typescript __generated__

throws:

Error: Unexpected argument: __generated__

All 3 comments

Below command worked.
apollo codegen:generate --queries="./src/**/*.js" --schema="./schema.json" --target="typescript"

That exact command yields the same error for me. Attempting to provide the "output" parameter per the documentation:

apollo codegen:generate --queries="./src/**/*.ts" --schema=./schema.json --target=typescript __generated__

throws:

Error: Unexpected argument: __generated__

Same as @jonlambert

Was this page helpful?
0 / 5 - 0 ratings