comigor / artemis

Build dart types from GraphQL schemas and queries
MIT License
496 stars 119 forks source link

Unable to use `ArtemisClient` in a package without specifying `build.yaml` config #375

Open CelticMajora opened 2 years ago

CelticMajora commented 2 years ago

Before reporting a bug, please test the beta branch!

Bug description

The project I am working on is a monorepo where our queries, models, etc live in a package separate from our app(lets call that package api). I'm injecting an ArtemisClient into that api package from my app to make queries because I want to be able to setup my own logging, headers, interceptors, etc. within the app, however when trying to run unrelated build_runner generation in the app package, I get the following error message:

[SEVERE] 
Missing `schema_mapping` configuration option. Cehck `build.yaml` configuration
pub finished with exit code 78

I think I'd expect the client to be provided as a separate package as the client feels like a separate responsibility from the code generation.

Specs

Artemis version: '>=7.0.0 <8.0.0'

build.yaml: ```yaml # Please paste your `build.yaml` file ``` I haven't configured artemis in `build.yaml` as for the app package I *only* want access to `ArtemisClient`, not any code generation tools.
Artemis output: ```bash [SEVERE] artemis:artemis: Missing `schema_mapping` configuration option. Cehck `build.yaml` configuration package:artemis/builder.dart 31:5 _builderOptionsToExpectedOutputs package:artemis/builder.dart 56:27 new GraphQLQueryBuilder package:artemis/builder.dart 17:5 graphQLQueryBuilder package:build_runner BuildCommand._run package:args/command_runner.dart 209:13 CommandRunner.runCommand package:build_runner run .dart_tool/build/entrypoint/build.dart 33:16 main ```
GraphQL schema: ```graphql # If possible, please paste your GraphQL schema file, # or a minimum reproducible schema of the bug. ``` No schema, as for the app package I *only* want access to `ArtemisClient`, not any code generation tools.
GraphQL query: ```graphql # If possible, please paste your GraphQL query file, # or a minimum reproducible query of the bug. ``` No query, as for the app package I *only* want access to `ArtemisClient`, not any code generation tools.