{"id":51218260,"url":"https://github.com/fast/serde-shape","last_synced_at":"2026-06-28T05:32:19.063Z","repository":{"id":366647427,"uuid":"1276486023","full_name":"fast/serde-shape","owner":"fast","description":"Reflect the shap of a serde-derived type.","archived":false,"fork":false,"pushed_at":"2026-06-22T18:01:45.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-22T19:23:48.452Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fast.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,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-06-22T02:55:02.000Z","updated_at":"2026-06-22T18:02:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fast/serde-shape","commit_stats":null,"previous_names":["fast/serde-shape"],"tags_count":1,"template":false,"template_full_name":"fast/template","purl":"pkg:github/fast/serde-shape","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fast%2Fserde-shape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fast%2Fserde-shape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fast%2Fserde-shape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fast%2Fserde-shape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fast","download_url":"https://codeload.github.com/fast/serde-shape/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fast%2Fserde-shape/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34878963,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"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":[],"created_at":"2026-06-28T05:32:18.309Z","updated_at":"2026-06-28T05:32:19.057Z","avatar_url":"https://github.com/fast.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# serde-shape\n\n[![Crates.io][crates-badge]][crates-url]\n[![Documentation][docs-badge]][docs-url]\n[![MSRV 1.85][msrv-badge]](https://www.whatrustisit.com)\n[![Apache 2.0 licensed][license-badge]][license-url]\n[![Build Status][actions-badge]][actions-url]\n\n[crates-badge]: https://img.shields.io/crates/v/serde-shape.svg\n[crates-url]: https://crates.io/crates/serde-shape\n[docs-badge]: https://img.shields.io/docsrs/serde-shape\n[docs-url]: https://docs.rs/serde-shape\n[msrv-badge]: https://img.shields.io/badge/MSRV-1.85-green?logo=rust\n[license-badge]: https://img.shields.io/crates/l/serde-shape\n[license-url]: LICENSE\n[actions-badge]: https://github.com/fast/serde-shape/workflows/CI/badge.svg\n[actions-url]: https://github.com/fast/serde-shape/actions?query=workflow%3ACI\n\n`serde-shape` reflects the shape of Serde serialization and deserialization at compile time.\n\nIt gives libraries and tools a lightweight graph of the Rust types, Serde names, field metadata, enum tagging, defaults, aliases, skips, and custom serializer/deserializer boundaries that make up a type's wire shape.\n\n## Install\n\nEnable the `derive` feature when you want `#[derive(SerializeShape)]` and `#[derive(DeserializeShape)]`:\n\n```toml\n[dependencies]\nserde-shape = { version = \"0.0.1\", features = [\"derive\"] }\n```\n\nEnable `std` when your reflected types use shapes provided only by the Rust standard library:\n\n```toml\n[dependencies]\nserde-shape = { version = \"0.0.1\", features = [\"derive\", \"std\"] }\n```\n\n## Motivation\n\nUse `serde-shape` when Serde already defines the contract you care about, but you also need to inspect that contract as data.\n\nTypical use cases:\n\n- generating configuration reference docs from config structs;\n- deriving environment variable names and value kinds from nested config;\n- documenting API or file-format shapes without handwritten schemas;\n- checking how a serialized or deserialized shape changes across releases;\n- building schema exporters that start from Serde metadata.\n\n`serde-shape` is intentionally not a full validation schema. It reflects the Serde data model shape and relevant Serde attributes; it does not infer value ranges, regexes, business rules, or runtime behavior hidden inside custom serializer/deserializer functions.\n\nYou may use [`schemars`](https://docs.rs/schemars) for JSON Schema generation and validation. But `schemars` is not a general-purpose Serde shape reflection library, and it does not support all Serde attributes. `serde-shape` is designed to be a more complete and general-purpose reflection of Serde shapes.\n\n## Example\n\nThe following example shows how to inspect a nested config type.\n\n```rust\nuse serde_shape::{\n    DeserializeDefinitionKind, DeserializeShape, FieldsStyle, ShapeRef,\n};\n\n#[derive(DeserializeShape)]\n#[serde(rename_all = \"kebab-case\", deny_unknown_fields)]\nstruct Config {\n    http_port: u16,\n    peers: Vec\u003cString\u003e,\n    tls: Option\u003cTlsConfig\u003e,\n}\n\n#[derive(DeserializeShape)]\n#[serde(rename_all = \"kebab-case\")]\nstruct TlsConfig {\n    cert_path: String,\n    key_path: String,\n}\n\nlet graph = Config::deserialize_shape();\nlet ShapeRef::Definition(config_id) = graph.root else {\n    panic!(\"Config should produce a named definition\");\n};\nlet definition = graph.definition(config_id).unwrap();\n\nlet DeserializeDefinitionKind::Struct(shape) = \u0026definition.kind else {\n    panic!(\"Config should produce a struct shape\");\n};\n\nassert_eq!(definition.type_name.name, \"Config\");\nassert_eq!(shape.style, FieldsStyle::Struct);\nassert!(shape.attributes.deny_unknown_fields);\nassert_eq!(shape.fields[0].name, \"http-port\");\nassert_eq!(shape.fields[1].name, \"peers\");\nassert_eq!(shape.fields[2].name, \"tls\");\n```\n\nSee the [crate documentation][docs-url] for the full shape graph model, derive behavior, and manual implementation examples.\n\n## Feature flags\n\n`serde-shape` enables no features by default.\n\n- `derive`: enables `#[derive(SerializeShape)]` and `#[derive(DeserializeShape)]`.\n- `std`: enables shape implementations for standard-library-only types.\n\n## `no_std` support\n\n`serde-shape` is `no_std` by default and requires `alloc`.\n\nEnable the `std` feature explicitly when your shapes use standard-library-only types.\n\n## Minimum Rust version policy\n\nThis crate's minimum supported `rustc` version is `1.85.0`.\n\nThe current policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if `crate 1.0` requires Rust 1.85.0, then `crate 1.0.z` for all values of `z` will also require Rust 1.85.0 or newer. However, `crate 1.y` for `y \u003e 0` may require a newer minimum version of Rust.\n\n## License\n\nThis project is licensed under [Apache License, Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffast%2Fserde-shape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffast%2Fserde-shape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffast%2Fserde-shape/lists"}