{"id":24534399,"url":"https://github.com/rolang/google-rest-api-codegen","last_synced_at":"2025-03-15T22:22:00.668Z","repository":{"id":272154843,"uuid":"862704287","full_name":"rolang/google-rest-api-codegen","owner":"rolang","description":"(Experimental) Google REST APIs client code generator ","archived":false,"fork":false,"pushed_at":"2025-03-15T05:51:08.000Z","size":423,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T06:29:15.945Z","etag":null,"topics":["code-generator","experimental","google-api-client","google-apis","google-cloud","jsoniter","jsoniter-scala","scala","scala-native","scala3","sttp","zio-json"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/rolang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2024-09-25T03:51:20.000Z","updated_at":"2025-03-01T07:23:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"179f2c6d-b896-436c-9b7d-14da915b7b3b","html_url":"https://github.com/rolang/google-rest-api-codegen","commit_stats":null,"previous_names":["rolang/google-rest-api-codegen"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolang%2Fgoogle-rest-api-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolang%2Fgoogle-rest-api-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolang%2Fgoogle-rest-api-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rolang%2Fgoogle-rest-api-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rolang","download_url":"https://codeload.github.com/rolang/google-rest-api-codegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243797599,"owners_count":20349432,"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":["code-generator","experimental","google-api-client","google-apis","google-cloud","jsoniter","jsoniter-scala","scala","scala-native","scala3","sttp","zio-json"],"created_at":"2025-01-22T11:17:07.910Z","updated_at":"2025-03-15T22:22:00.660Z","avatar_url":"https://github.com/rolang.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# (Experimental) Google APIs client code generator\n\n![Maven Central Version](https://img.shields.io/maven-central/v/dev.rolang/gcp-codegen_3)\n[![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.rolang/gcp-codegen_3.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/rolang/gcp-codegen_3/)\n\n⚠️ _This project is in an experimental stage (with a messy code base), use with care if you want to give it a try_.\n\nGenerates client code from Google's [disovery document](https://developers.google.com/discovery/v1/using) for your Scala (3) tech stack.  \nCurrently it provides following configurations for generated code:\n - Http sources: [Sttp4](https://sttp.softwaremill.com/en/latest), [Sttp3](https://sttp.softwaremill.com/en/stable)\n - JSON codecs: [Jsoniter](https://github.com/plokhotnyuk/jsoniter-scala), [ZioJson](https://zio.dev/zio-json)\n - JSON Array collection type: `List`, `Vector`, `Array`, `ZioChunk`\n\n__NOTE__: Generated code does not include authentication.\n\nIf you're using [http4s](https://github.com/http4s/http4s) and [circe](https://github.com/circe/circe) you may also want to check some similar projects:\n - [hamnis/google-discovery-scala](https://github.com/hamnis/google-discovery-scala)\n - [armanbilge/gcp4s](https://github.com/armanbilge/gcp4s)\n\n### Usage\n\nThe generator can be used with any tool that can perform system calls to a command line executable or add Scala 3 dependencies (e.g. [scala command line](https://scala-cli.virtuslab.org/), [sbt 1](https://www.scala-sbt.org/1.x/docs/), [sbt 2](https://www.scala-sbt.org/2.x/docs/en/index.html), [mill](https://mill-build.org), etc.).  \n\n#### Usage via Scala command line example\nSee example under [example/generate.scala](./example/generate.scala).\n\n```scala\n//\u003e using scala 3.6.3\n//\u003e using dep dev.rolang::gcp-codegen::0.0.2\n\nimport gcp.codegen.*, java.nio.file.*, GeneratorConfig.*\n\n@main def run =\n  val files = Task(\n    specsInput = SpecsInput.FilePath(Path.of(\"pubsub_v1.json\")),\n    config = GeneratorConfig(\n      outDir = Path.of(\"out\"),\n      outPkg = \"example.pubsub.v1\",\n      httpSource = HttpSource.Sttp4,\n      jsonCodec = JsonCodec.Jsoniter,\n      dialect = Dialect.Scala3,\n      arrayType = ArrayType.List,\n      preprocess = specs =\u003e specs\n    )\n  ).runAwait()\n  println(s\"Generated ${files.length} files\")\n```\nRun example:\n```shell\ncd example \u0026\u0026 scala generate.scala \u0026\u0026 scala fmt ./out\n```\nSee output in `example/out`.\n\n#### Command-line executable usage\n\n##### Configuration parameters (currently supported):\n\n| Configuration       | Description | Options | Default |\n| ------------------- | ---------------- | ------- | --- |\n| -specs             | Can be `stdin` or a path to the JSON file. | | |\n| -out-dir           | Ouput directory | | |\n| -out-pkg           | Output package |  | |\n| -http-source       | Generated http source. | [Sttp4](https://sttp.softwaremill.com/en/latest), [Sttp3](https://sttp.softwaremill.com/en/stable) | |\n| -json-codec        | Generated JSON codec | [Jsoniter](https://github.com/plokhotnyuk/jsoniter-scala), [ZioJson](https://zio.dev/zio-json)  | |\n| -array-type        | Collection type for JSON arrays | `List`, `Vector`, `Array`, `ZioChunk` | `List` |\n| -include-resources | Optional resource filter. | | |\n\n##### Examples:\n\n_Command line binaries are not published (not yet).  \nA command line binary can be built from the source via `sbt buildCliBinary`.  \nThe output directory is `modules/cli/target/bin`.  \nE.g. on Linux the output file will be like `modules/cli/target/bin/gcp-codegen-x86_64-linux`._\n\n```shell\ncurl 'https://pubsub.googleapis.com/$discovery/rest?version=v1' \u003e pubsub_v1.json\n\n# the path to the executable may be different\n./modules/cli/target/bin/gcp-codegen-x86_64-linux \\\n  -out-dir=src/scala/main/generated \\\n  -specs=./pubsub_v1.json \\\n  -out-pkg=gcp.pubsub.v1 \\\n  -http-source=sttp4 \\\n  -json-codec=jsoniter \\\n  -include-resources='projects.*,!projects.snapshots' # optional filters\n```\n\n### Building and testing\n\nGenerate, compile and run tests for generated code\n```shell\nsbt buildCliBinary test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolang%2Fgoogle-rest-api-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frolang%2Fgoogle-rest-api-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frolang%2Fgoogle-rest-api-codegen/lists"}