{"id":15023238,"url":"https://github.com/nis5l/rocketjson","last_synced_at":"2025-06-11T05:32:36.407Z","repository":{"id":46859216,"uuid":"401017726","full_name":"Nis5l/rocketjson","owner":"Nis5l","description":"Crate for working with Json and Rocket.","archived":false,"fork":false,"pushed_at":"2024-11-02T13:35:50.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-08T21:27:52.809Z","etag":null,"topics":["api","json","rocket","rust","server","web"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nis5l.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":"2021-08-29T10:52:59.000Z","updated_at":"2024-11-02T13:35:54.000Z","dependencies_parsed_at":"2025-02-11T23:32:24.869Z","dependency_job_id":"a02952ef-d72c-4dfa-a4c0-b928d51ef786","html_url":"https://github.com/Nis5l/rocketjson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nis5l%2Frocketjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nis5l%2Frocketjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nis5l%2Frocketjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nis5l%2Frocketjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nis5l","download_url":"https://codeload.github.com/Nis5l/rocketjson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nis5l%2Frocketjson/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259207565,"owners_count":22821703,"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":["api","json","rocket","rust","server","web"],"created_at":"2024-09-24T19:58:51.811Z","updated_at":"2025-06-11T05:32:36.388Z","avatar_url":"https://github.com/Nis5l.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rocketjson\n[![Current Crates.io Version](https://img.shields.io/crates/v/rocketjson.svg)](https://crates.io/crates/rocketjson)\n\nCrate for working with Json and [Rocket](https://github.com/SergioBenitez/Rocket). \\\nUltimately the goal is to have [validated](https://github.com/Keats/validator) Structs enter and leave the endpoint as Json\nwhile having everything happen in the background.\n\n# Documentation\nDocumentation is on [docs.rs](https://docs.rs/rocketjson)\n\n# Example\n```\n#[macro_use] extern crate rocket;\n\n#[derive(serde::Deserialize, validator::Validate, rocketjson::JsonBody)]\npub struct RegisterRequest {\n   #[validate(length(min = 1))]\n   username: String \n}\n\n#[derive(serde::Serialize)]\npub struct RegisterResponse {\n   message: String\n}\n\n#[post(\"/register\", data=\"\u003cdata\u003e\")]\npub fn register(data: RegisterRequest) -\u003e rocketjson::ApiResponse\u003cRegisterResponse\u003e {\n   rocketjson::ApiResponse::new(rocket::http::Status::Ok, RegisterResponse { message: format!(\"Welcome {}\", data.username) })\n}\n\n#[launch]\nfn rocket() -\u003e _ {\n    rocket::build()\n        .mount(\"/\", routes![register]).\n        register(\"/\", vec![rocketjson::error::get_catcher()])\n}\n```\n- Input \n```\n{\n    \"username\": \"testuser\"\n}\n```\n- Output 200 OK\n```\n{\n    \"message\": \"Welcome testuser\"\n}\n```\n- Input\n```\n{\n    \"username\": \"\"\n}\n```\n- Output 400 Bad Request\n```\n{\n    \"username\": [\n        {\n            \"code\": \"length\",\n            \"message\": null,\n            \"params\": {\n                \"value\": \"\",\n                \"min\": 1\n            }\n        }\n    ]\n}\n```\n# License\nThe license can be chosen to be either of the following:\n- [MIT](https://opensource.org/licenses/MIT)\n- [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnis5l%2Frocketjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnis5l%2Frocketjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnis5l%2Frocketjson/lists"}