{"id":18771326,"url":"https://github.com/blockscout/actix-prost","last_synced_at":"2025-04-13T07:32:25.618Z","repository":{"id":104922014,"uuid":"532852540","full_name":"blockscout/actix-prost","owner":"blockscout","description":"Actix route generator for gRPC server","archived":false,"fork":false,"pushed_at":"2024-08-26T17:02:55.000Z","size":199,"stargazers_count":5,"open_issues_count":10,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-08-27T10:21:38.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/blockscout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-05T10:33:08.000Z","updated_at":"2024-08-26T16:15:55.000Z","dependencies_parsed_at":"2024-01-25T08:44:13.754Z","dependency_job_id":"2ccd302f-afb5-4053-a824-1916c9231386","html_url":"https://github.com/blockscout/actix-prost","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Factix-prost","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Factix-prost/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Factix-prost/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockscout%2Factix-prost/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockscout","download_url":"https://codeload.github.com/blockscout/actix-prost/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223575171,"owners_count":17167625,"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":[],"created_at":"2024-11-07T19:24:17.366Z","updated_at":"2024-11-07T19:24:18.235Z","avatar_url":"https://github.com/blockscout.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# actix-prost\n\nGenerate actix handles and routes with ease!\n\n## Usage\n\nYou can see some examples in [tests](tests/) crate\n\n### Limitations\n\nCurrently, due to lack of `prost` support for custom extensions, `google.api.http` options are not supported in proto files.\n\nInstead, you can write [`.yaml` api](https://cloud.google.com/endpoints/docs/grpc/transcoding#configuring_transcoding_in_yaml), which we can read and parse, and provide it in `build.rs`\n\n### Steps\n\nAdd this to `Cargo.toml`\n\n```toml\n[dependencies]\n# we're not released yet\nactix-prost = { git = \"https://github.com/blockscout/actix-prost\" }\nactix-web = \"4\"\nserde = { version = \"1\", features = [\"derive\"] }\nasync-trait = \"0.1\"\nprost = \"0.11\"\ntonic = \"0.8\"\n\n[build-dependencies]\nactix-prost-build = { git = \"https://github.com/blockscout/actix-prost\" }\ntonic-build = \"0.8\"\nprost-build = \"0.11\"\n```\n\nAnd add this to `build.rs`\n\n```rust\nuse actix_prost_build::{ActixGenerator, GeneratorList};\nuse prost_build::{Config, ServiceGenerator};\nuse std::path::Path;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let api = \"path/to/api.yaml\";\n    let gens = Box::new(GeneratorList::new(vec![\n        // tonic generator is required, because we need it's trait\n        tonic_build::configure().service_generator(),\n        // actix generator\n        Box::new(ActixGenerator::new(api).unwrap()),\n    ]));\n    let mut config = Config::new();\n    config\n        .service_generator(generator)\n        // this is not required, but it will force protoc to check that yaml is valid\n        .protoc_arg(format!(\"grpc_api_configuration={},output_format=yaml\", api))\n        // this is required\n        .type_attribute(\".\", \"#[derive(serde::Serialize, serde::Deserialize)]\");\n    config.compile_protos(protos, includes)?;\n    Ok(())\n}\n```\n\n## What's here and what's not\n\n\u003e ✔️ = done, ⌛ = will be done soon, ❌ = not planned\n\n * ✔️ Generate custom handlers, which calls `gRPC` implementation\n * ✔️ Use `path`, `query` and `json` extractors\n * ✔️ Return `json` encoded response\n * ✔️ Use recommended mapping from `gRPC` codes to `http` codes\n * ✔️ Generate router which will route all the handlers\n * ✔️ Pass headers into `tonic::Request`\n * ✔️ Map response using `response_body`\n * ⌛ Support `google.api.http` options inside proto files (as soon, as `prost` will support them)\n * ❌ Use all the features from `gRPC` path option\n * ❌ `http` client implementation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockscout%2Factix-prost","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockscout%2Factix-prost","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockscout%2Factix-prost/lists"}