{"id":14976156,"url":"https://github.com/anitrend/retrofit-graphql","last_synced_at":"2025-04-05T11:09:18.124Z","repository":{"id":52433271,"uuid":"128179094","full_name":"AniTrend/retrofit-graphql","owner":"AniTrend","description":"Retrofit converter which uses annotations to inject .graphql query or mutation files into a request body, along with any variables.","archived":false,"fork":false,"pushed_at":"2025-04-01T16:35:58.000Z","size":6471,"stargazers_count":107,"open_issues_count":2,"forks_count":19,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-05T11:09:06.381Z","etag":null,"topics":["android","graphql","graphql-files","graphql-query","graphql-variables","persisted-queries","retrofit-converter","retrofit2"],"latest_commit_sha":null,"homepage":"https://anitrend.github.io/retrofit-graphql/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AniTrend.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-05T08:31:24.000Z","updated_at":"2025-04-01T16:32:39.000Z","dependencies_parsed_at":"2024-06-25T21:13:04.294Z","dependency_job_id":"6edf61a7-9ec4-419a-9c6e-4919bba2348a","html_url":"https://github.com/AniTrend/retrofit-graphql","commit_stats":{"total_commits":342,"total_committers":13,"mean_commits":"26.307692307692307","dds":0.4064327485380117,"last_synced_commit":"a65c62e10fccf87b12535729d1c6d8196291efd9"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AniTrend%2Fretrofit-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AniTrend%2Fretrofit-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AniTrend%2Fretrofit-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AniTrend%2Fretrofit-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AniTrend","download_url":"https://codeload.github.com/AniTrend/retrofit-graphql/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"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":["android","graphql","graphql-files","graphql-query","graphql-variables","persisted-queries","retrofit-converter","retrofit2"],"created_at":"2024-09-24T13:53:24.188Z","updated_at":"2025-04-05T11:09:18.103Z","avatar_url":"https://github.com/AniTrend.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Retrofit Converter - With GraphQL Support \u0026nbsp; [![](https://jitpack.io/v/anitrend/retrofit-graphql.svg)](https://jitpack.io/#AniTrend/retrofit-graphql) \u0026nbsp; [![Codacy Badge](https://app.codacy.com/project/badge/Grade/429330bfbee34bb29a74e5cd01220c68)](https://app.codacy.com/gh/AniTrend/retrofit-graphql/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade) \u0026nbsp; [![android-unit-test](https://github.com/AniTrend/retrofit-graphql/actions/workflows/android-test.yml/badge.svg)](https://github.com/AniTrend/retrofit-graphql/actions/workflows/android-test.yml)\n\nSeeing how we already have a really powerful type-safe HTTP client for Android and Java\n[Retrofit](http://square.github.io/retrofit/) why not use it and extend it's functionality,\nthis project is a retrofit converter which uses annotations to inject .graphql query or mutation\nfile contents into a request body along with any GraphQL variables.\n\n## Why This Project Exists?\n\nMany might wonder why this exists when an android GraphQL library like [Apollo](https://github.com/apollographql/apollo-android) exists. Unfortunately Apollo for Android still lacks some basic but important features/functionality which led to the following questions about [General Design Questions Regarding Apollo](https://github.com/apollographql/apollo-android/issues/847), [Polymorphic Type Handling](https://github.com/apollographql/apollo-android/issues/334) and [Non Shared Types](https://github.com/apollographql/apollo-android/issues/898). Don't get me wrong Apollo is not inferior any way, it has amazing features such as:\n\n- Code Generation (Classes and Data Types)\n- Custom Scalar Types\n- Cached Responses\n\nBut since model classes are automatically generated for you, the developer loses some flexibility, such as use of generics, abstraction and inheritance.\nAlso Android Performance best practice suggests that developers should use StringDef and IntDef over\nenums and [here's why](https://stackoverflow.com/questions/29183904/should-i-strictly-avoid-using-enums-on-android), with the exception of kotlin\nespecially when using R8.\n\nStrangely there are tons of simple examples all over Medium using apollo graphql for Android,\nbut none of them address these issues because most of them just construct a simple single resource\nrequest demo application. These look just fine at first glance until you start working with multiple data types and apollo starts generating classes for every fragment and query even if the data models are the same, or share similar properties.\n\nSee a list of changes from [here](./CHANGELOG.md)\n____\n\n## How Everything Works\n\n### Getting Started\n\n- __Add the JitPack repository to your build file__\n\n```javascript\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://www.jitpack.io' }\n    }\n}\n```\n\n- __Add the dependency__\n\n```javascript\ndependencies {\n    implementation 'com.github.anitrend:retrofit-graphql:{latest_version}'\n}\n```\n\n- __Optional R8 / ProGuard Rules__\n\nIf you are using R8 the shrinking and obfuscation rules are included automatically.\n\nProGuard users must manually copy the options from [this file](https://github.com/anitrend/retrofit-graphql/blob/master/library/proguard-rules.pro).\n\n\u003e You might also need [retrofit rules](https://github.com/square/retrofit/blob/master/retrofit/src/main/resources/META-INF/proguard/retrofit2.pro) and it's dependencies (OkHttp and Okio)\n\n### Examples\n\nDefine, your `.graphql` files for your GraphQL queries, fragments, and mutations e.t.c.\n\nIf you use insomnia you can use this tool to generate your workspaces into directories and files\n[insomnia-graphql-generator](https://github.com/anitrend/insomnia-graphql-generator). After you can\nsimply place the generated content into your assets folder e.g.:\n\n\u003cimg src=\"./images/screenshots/assets_files.png\" width=250 /\u003e\n\n\u003e **N.B.** You might find this too useful too JetBrains [JS GraphQL - Plugin](https://plugins.jetbrains.com/plugin/8097-js-graphql)\n\nFor more instructions on how to setup the sample app and other examples with file uploads,\npersisted queries, custom loggers, custom graphql files location (outside assets) please visit\nthe [projects wiki page](https://github.com/anitrend/retrofit-graphql/wiki)\n\n#### Screenshots\n\n\u003cimg src=\"./images/screenshots/sample_img_001.png\" width=250 /\u003e \u003cimg src=\"./images/screenshots/sample_img_002.png\" width=250 /\u003e\n\u003cimg src=\"./images/screenshots/sample_img_003.png\" width=250 /\u003e \u003cimg src=\"./images/screenshots/sample_img_004.png\" width=250 /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanitrend%2Fretrofit-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanitrend%2Fretrofit-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanitrend%2Fretrofit-graphql/lists"}