{"id":27184193,"url":"https://github.com/nobane/reflect_to","last_synced_at":"2026-03-11T16:35:55.331Z","repository":{"id":286935916,"uuid":"963013424","full_name":"nobane/reflect_to","owner":"nobane","description":"Generate type information in other languages based on rust types.","archived":false,"fork":false,"pushed_at":"2025-04-10T19:46:34.000Z","size":73,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T05:40:10.078Z","etag":null,"topics":["python","reflection","rtti","rust","typescript"],"latest_commit_sha":null,"homepage":"","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/nobane.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,"zenodo":null}},"created_at":"2025-04-09T02:56:20.000Z","updated_at":"2025-04-10T19:46:26.000Z","dependencies_parsed_at":"2025-04-11T14:41:31.797Z","dependency_job_id":"96bab7f1-1a49-43c8-b103-3f05085a28b6","html_url":"https://github.com/nobane/reflect_to","commit_stats":null,"previous_names":["nobane/reflect_to"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nobane/reflect_to","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nobane%2Freflect_to","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nobane%2Freflect_to/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nobane%2Freflect_to/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nobane%2Freflect_to/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nobane","download_url":"https://codeload.github.com/nobane/reflect_to/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nobane%2Freflect_to/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271732356,"owners_count":24811309,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["python","reflection","rtti","rust","typescript"],"created_at":"2025-04-09T16:38:17.381Z","updated_at":"2026-03-11T16:35:50.311Z","avatar_url":"https://github.com/nobane.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reflect To\n\n\n- Generate type information in other languages based on rust types.\n    - Adhere to `serde` serialization behaviors whenever possible.\n- Builds upon a reusable [rtti](https://en.wikipedia.org/wiki/Run-time_type_information) foundation in rust.\n- Supported language type conversions:\n    - typescript via `typescript`flag (on by default)\n    - python via `python` flag\n        - **NOTE**: Still an active WIP!\n\n# Typescript Example\n\nBy using the `Reflect` derive:\n\n```rs\nuse reflect_to::Reflect;\nuse serde::{Deserialize, Serialize};\nuse std::{collections::HashMap, path::PathBuf};\n\n#[derive(Reflect, Serialize, Deserialize, Debug, Clone)]\n#[serde(rename_all = \"camelCase\")]\npub struct User {\n    email: String,\n    is_active: bool,\n    uploaded_files: Vec\u003cUserPost\u003e,\n    profile_image: Option\u003cString\u003e,\n    settings: UserSettings,\n    status: UserStatus,\n}\n\n#[derive(Reflect, Serialize, Deserialize, Debug, Clone)]\npub enum UserStatus {\n    Offline,\n    Online { status: String },\n    Unknown(String),\n}\n\n#[derive(Reflect, Serialize, Deserialize, Debug, Clone)]\npub struct UserPost {\n    post_name: Option\u003cString\u003e,\n    contents: Vec\u003cString\u003e,\n}\n\n#[derive(Reflect, Serialize, Deserialize, Debug, Clone)]\n#[serde(rename_all = \"camelCase\")]\npub struct UserSettings {\n    theme_path: PathBuf,\n    email_notifications: bool,\n    #[serde(rename = \"custom\")]\n    custom_settings: HashMap\u003cString, String\u003e,\n}\n```\n\nthe following type information can be generated at runtime (for instance as part of a wasm build process):\n\n```ts\nexport interface User {\n    email: string;\n    isActive: boolean;\n    uploadedFiles: UserPost[];\n    profileImage: string | null;\n    settings: UserSettings;\n    status: UserStatus;\n}\n\nexport type UserStatus =\n    \"Offline\"\n    | { \"Online\": {\n        status: string;\n    } }\n    | { \"Unknown\": string }\n\nexport interface UserPost {\n    post_name: string | null;\n    contents: string[];\n}\n\nexport interface UserSettings {\n    themePath: string\n    emailNotifications: boolean\n    custom: Record\u003cstring, string\u003e;\n}\n```\n\n# Demo\n\nRun one of the examples via\n\n```\ncargo run --example to_python\n```\nor\n\n```\ncargo run --example to_typescript\n```\n\n# Documentation\n\nFor now, the best documentation is the [typescript](crates/to_typescript/examples/to_typescript.rs) and [python](crates/to_python/examples/to_python.rs) examples.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnobane%2Freflect_to","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnobane%2Freflect_to","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnobane%2Freflect_to/lists"}