{"id":13471179,"url":"https://github.com/comigor/artemis","last_synced_at":"2025-10-12T18:30:22.695Z","repository":{"id":38984210,"uuid":"189489748","full_name":"comigor/artemis","owner":"comigor","description":"Build dart types from GraphQL schemas and queries","archived":true,"fork":false,"pushed_at":"2023-10-24T11:35:16.000Z","size":1787,"stargazers_count":494,"open_issues_count":48,"forks_count":121,"subscribers_count":9,"default_branch":"beta","last_synced_at":"2025-01-17T12:06:01.979Z","etag":null,"topics":["apollo","apollo-dart","artemis","dart","flutter","graphql","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/comigor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":"comigor","patreon":"comigor","custom":["https://www.blockchain.com/btc/payment_request?address=1M1NJGg4SE7eaGUPUxQmqT9U1NhNYzW22J","https://api.qrserver.com/v1/create-qr-code/?data=xrb%3Anano_1jbe6nohyhpswj8gea8d7bpdd1ixxcmf3haj7gcrwzfweiwrmwuh33gpu1q3"]}},"created_at":"2019-05-30T22:18:53.000Z","updated_at":"2024-12-10T13:20:56.000Z","dependencies_parsed_at":"2023-02-17T23:01:31.237Z","dependency_job_id":"1cb7436b-8bc1-4e28-86e1-86d19fa99bff","html_url":"https://github.com/comigor/artemis","commit_stats":{"total_commits":652,"total_committers":21,"mean_commits":"31.047619047619047","dds":0.4877300613496932,"last_synced_commit":"e1a213400a84dc44eb830bd90f26efe12bb2874c"},"previous_names":[],"tags_count":154,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comigor%2Fartemis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comigor%2Fartemis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comigor%2Fartemis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comigor%2Fartemis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/comigor","download_url":"https://codeload.github.com/comigor/artemis/tar.gz/refs/heads/beta","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236261789,"owners_count":19120775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apollo","apollo-dart","artemis","dart","flutter","graphql","hacktoberfest"],"created_at":"2024-07-31T16:00:41.114Z","updated_at":"2025-10-12T18:30:22.356Z","avatar_url":"https://github.com/comigor.png","language":"Dart","readme":"\u003c!-- @formatter:off --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://user-images.githubusercontent.com/735858/58768495-8ecbd600-8572-11e9-9321-4fa5ce4ea007.png\" height=\"200\"\u003e\n  \u003ch1\u003e\u003cb\u003eArtemis\u003c/b\u003e\u003c/h1\u003e\n\u003c/p\u003e\n\n\u003c!-- **Build dart types from GraphQL schemas and queries** --\u003e\n\n## Notice\n\nArtemis has been [discontinued](https://github.com/gql-dart/ferry/issues/541).\n\nFor alternatives, take a look at the [Ferry](https://pub.dev/packages/ferry) project, featuring code generation for data types, customizable network layer (using `gql_link`), cache, data store connections, refetching + pagination support and more.\n\nAlso check out [graphql](https://pub.dev/packages/graphql), with features closely matching the current Artemis state: fully-featured client (for Dart and Flutter) with persistence, type generation (with [graphql_codegen](https://pub.dev/packages/graphql_codegen)), cache, and more.\n\nUsers and community are also invited to join the [GraphQL Dart](https://discord.gg/Pu8AMajSd) Discord to discuss migration approaches and ask for support.\n\nThanks to all contributors and users that made this project possible.\n\n\u003cdetails\u003e\n  \u003csummary\u003eTo check out the old README, click here.\u003c/summary\u003e\n\n\u003c!-- Badges --\u003e\n[![View at pub.dev][pub-badge]][pub-link]\n[![Test][actions-badge]][actions-link]\n[![PRs Welcome][prs-badge]][prs-link]\n[![Star on GitHub][github-star-badge]][github-star-link]\n[![Fork on GitHub][github-forks-badge]][github-forks-link]\n[![Discord][discord-badge]][discord-link]\n\n[pub-badge]: https://img.shields.io/pub/v/artemis?style=for-the-badge\n[pub-link]: https://pub.dev/packages/artemis\n\n[actions-badge]: https://img.shields.io/github/workflow/status/comigor/artemis/test?style=for-the-badge\n[actions-link]: https://github.com/comigor/artemis/actions\n\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge\n[prs-link]: https://github.com/comigor/artemis/issues\n\n[github-star-badge]: https://img.shields.io/github/stars/comigor/artemis.svg?style=for-the-badge\u0026logo=github\u0026logoColor=ffffff\n[github-star-link]: https://github.com/comigor/artemis/stargazers\n\n[github-forks-badge]: https://img.shields.io/github/forks/comigor/artemis.svg?style=for-the-badge\u0026logo=github\u0026logoColor=ffffff\n[github-forks-link]: https://github.com/comigor/artemis/network/members\n\n[discord-badge]: https://img.shields.io/discord/559455668810153989.svg?style=for-the-badge\u0026logo=discord\u0026logoColor=ffffff\n[discord-link]: https://discord.gg/2Y4wdE4\n\nCheck the [**beta**](https://github.com/comigor/artemis/tree/beta) branch for the bleeding edge (and breaking) stuff.\n\nArtemis is a code generator that looks for `schema.graphql` (GraphQL SDL - Schema Definition Language) and `*.graphql` files and builds `.graphql.dart` files typing that query, based on the schema. That's similar to what [Apollo](https://github.com/apollographql/apollo-client) does (Artemis is his sister anyway).\n\n---\n\n## **Installation**\nAdd the following to your `pubspec.yaml` file to be able to do code generation:\n```yaml\ndev_dependencies:\n  artemis: '\u003e=7.0.0 \u003c8.0.0'\n  build_runner: ^2.1.4\n  json_serializable: ^6.0.1\n```\nThe generated code uses the following packages in run-time:\n```yaml\ndependencies:\n  artemis: '\u003e=8.0.0 \u003c8.0.0' # only if you're using ArtemisClient!\n  json_annotation: ^4.3.0\n  equatable: ^2.0.3\n  gql: ^0.13.1-alpha\n```\n\nThen run:\n```shell\ndart pub get\n```\nor\n```shell\nflutter pub get\n```\n\nNow Artemis will generate the API files for you by running:\n```shell\ndart run build_runner build\n```\nor\n```shell\nflutter pub run build_runner build\n```\n\n## **Configuration**\nArtemis offers some configuration options to generate code. All options should be included on `build.yaml` file on the root of the project:\n```yaml\ntargets:\n  $default:\n    builders:\n      artemis:\n        options:\n          # custom configuration options!\n```\n\n\u003e ⚠️ Make sure your configuration file is called `build.yaml` (with `.yaml` extension, not `.yml`)!\n\n| Option | Default value | Description |\n| - | - | - |\n| `generate_helpers` | `true` | If Artemis should generate query/mutation helper GraphQLQuery subclasses. |\n| `scalar_mapping` | `[]` | Mapping of GraphQL and Dart types. See [Custom scalars](#custom-scalars). |\n| `schema_mapping` | `[]` | Mapping of queries and which schemas they will use for code generation. See [Schema mapping](#schema-mapping). |\n| `fragments_glob` | `null` | Import path to the file implementing fragments for all queries mapped in schema_mapping. If it's assigned, fragments defined in schema_mapping will be ignored. |\n| `ignore_for_file` | `[]`  | The linter rules to ignore for artemis generated files. |\n| `generate_queries` | `true` | If Artemis should generate query documents and operation names. If you are using Artemis with `graphql` library it is useful to have those queries and operation names generated but without Atremis specific classes to exclude Artemis from dependancies |\n\nIt's important to remember that, by default, [build](https://github.com/dart-lang/build) will follow [Dart's package layout conventions](https://dart.dev/tools/pub/package-layout), meaning that only some folders will be considered to parse the input files. So, if you want to reference files from a folder other than `lib/`, make sure you've included it on `sources`:\n```yaml\ntargets:\n  $default:\n    sources:\n      - lib/**\n      - graphql/**\n      - data/**\n      - schema.graphql\n```\n\n### **Schema mapping**\nBy default, Artemis won't generate anything. That's because your queries/mutations should be linked to GraphQL schemas. To configure it, you need to point a `schema_mapping` to the path of those queries and schemas:\n\n```yaml\ntargets:\n  $default:\n    builders:\n      artemis:\n        options:\n          schema_mapping:\n            - output: lib/graphql_api.graphql.dart\n              schema: lib/my_graphql_schema.graphql\n              queries_glob: lib/**.graphql\n```\n\nEach `SchemaMap` is configured this way:\n\n| Option | Default value | Description |\n| - | - | - |\n| `output` | | Relative path to output the generated code. It should end with `.graphql.dart` or else the generator will need to generate one more file. |\n| `schema` | | Relative path to the GraphQL schema. |\n| `queries_glob` | | Glob that selects all query files to be used with this schema. |\n| `naming_scheme` | `pathedWithTypes` | The naming scheme to be used on generated classes names. `pathedWithTypes` is the default for retrocompatibility, where the names of previous types are used as prefix of the next class. This can generate duplication on certain schemas. With `pathedWithFields`, the names of previous fields are used as prefix of the next class and with `simple`, only the actual GraphQL class nameis considered. |\n| `type_name_field` | `__typename` | The name of the field used to differentiate interfaces and union types (commonly `__typename` or `__resolveType`). Note that `__typename` field are not added automatically to the query. If you want interface/union type resolution, you need to manually add it there or set `append_type_name` to `true`. |\n| `append_type_name` | `false` | Appends `type_name_field` value to the query selections set. |\n| `fragments_glob` | `null` | Import path to the file implementing fragments for all queries mapped in schema_mapping. |\n\nSee [examples](./example) for more information and configuration options.\n\n### **Custom scalars**\n\nIf your schema uses custom scalars, they must be defined on `build.yaml`. If it needs a custom parser (to decode from/to json), the `custom_parser_import` path must be set and the file must implement both `fromGraphQL___ToDart___` and `fromDart___ToGraphQL___` constant functions.\n\n`___ToDart___` and `___ToGraphQL___` should be named including nullability, here is an example:\n\n* `file: Upload` =\u003e `fromGraphQLUploadNullableToDartMultipartFileNullable`\nand `fromDartMultipartFileNullableToGraphQLUploadNullable`\n* `file: Upload!` =\u003e `fromGraphQLUploadToDartMultipartFile` and `fromDartMultipartFileToGraphQLUpload`\n* `file: [Upload]` =\u003e `fromGraphQLListNullableUploadNullableToDartListNullableMultipartFileNullable`\nand `fromDartListNullableMultipartFileNullableToGraphQLListNullableUploadNullable`\n* `file: [Upload]!` =\u003e `fromGraphQLListUploadNullableToDartListMultipartFileNullable`\nand `fromDartListMultipartFileNullableToGraphQLListUploadNullable`\n* `file: [Upload!]!` =\u003e `fromGraphQLListUploadToDartListMultipartFile` and `fromDartListMultipartFileToGraphQLListUpload`\n\n```yaml\ntargets:\n  $default:\n    builders:\n      artemis:\n        options:\n          scalar_mapping:\n            - custom_parser_import: 'package:graphbrainz_example/coercers.dart'\n              graphql_type: Date\n              dart_type: DateTime\n```\n\nIf your custom scalar needs to import Dart libraries, you can provide it in the config as well:\n\n```yaml\ntargets:\n  $default:\n    builders:\n      artemis:\n        options:\n          scalar_mapping:\n            - custom_parser_import: 'package:graphbrainz_example/coercers.dart'\n              graphql_type: BigDecimal\n              dart_type:\n                name: Decimal\n                imports:\n                  - 'package:decimal/decimal.dart'\n```\n\nEach `ScalarMap` is configured this way:\n\n| Option | Default value | Description |\n| - | - | - |\n| `graphql_type` |  | The GraphQL custom scalar name on schema. |\n| `dart_type` |  | The Dart type this custom scalar should be converted from/to. |\n| `custom_parser_import` | `null` | Import path to the file implementing coercer functions for custom scalars. See [Custom scalars](#custom-scalars). |\n\nSee [examples](./example) for more information and configuration options.\n\n## **Articles and videos**\n\n1. [Ultimate toolchain to work with GraphQL in Flutter](https://medium.com/@v.ditsyak/ultimate-toolchain-to-work-with-graphql-in-flutter-13aef79c6484)\n2. [Awesome GraphQL](https://github.com/chentsulin/awesome-graphql)\n\n## **ArtemisClient**\nIf you have `generate_helpers`, Artemis will create a subclass of `GraphQLQuery` for you, this class can be used\nin conjunction with `ArtemisClient`.\n\n```dart\nfinal client = ArtemisClient('/graphql');\nfinal gitHubReposQuery = MyGitHubReposQuery();\nfinal response = await client.execute(gitHubReposQuery);\n```\n\n`ArtemisClient` adds type-awareness around `Link` from [`package:gql/link`](https://pub.dev/packages/gql).\nYou can create `ArtemisClient` from any `Link` using `ArtemisClient.fromLink`.\n \nCheck the [examples](./example) to see how to use it in details.\n\n\u003c/details\u003e\n","funding_links":["https://github.com/sponsors/comigor","https://patreon.com/comigor","https://www.blockchain.com/btc/payment_request?address=1M1NJGg4SE7eaGUPUxQmqT9U1NhNYzW22J","https://api.qrserver.com/v1/create-qr-code/?data=xrb%3Anano_1jbe6nohyhpswj8gea8d7bpdd1ixxcmf3haj7gcrwzfweiwrmwuh33gpu1q3"],"categories":["Dart","Libraries","Implementations"],"sub_categories":["Dart Libraries","Dart"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomigor%2Fartemis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomigor%2Fartemis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomigor%2Fartemis/lists"}