{"id":19502384,"url":"https://github.com/zio/zio-schema","last_synced_at":"2026-03-08T11:06:56.858Z","repository":{"id":37000072,"uuid":"314807098","full_name":"zio/zio-schema","owner":"zio","description":"Compositional, type-safe schema definitions, which enable auto-derivation of codecs and migrations.","archived":false,"fork":false,"pushed_at":"2026-01-23T07:03:18.000Z","size":2759,"stargazers_count":160,"open_issues_count":68,"forks_count":190,"subscribers_count":15,"default_branch":"main","last_synced_at":"2026-01-24T00:32:32.633Z","etag":null,"topics":["avro","bson","json","msg-pack","protobuf","scala","thrift","zio"],"latest_commit_sha":null,"homepage":"https://zio.dev/zio-schema","language":"Scala","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/zio.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":".github/CODEOWNERS","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":null,"dco":null,"cla":"CLA.md"}},"created_at":"2020-11-21T12:28:31.000Z","updated_at":"2026-01-23T07:03:23.000Z","dependencies_parsed_at":"2023-10-15T02:31:12.769Z","dependency_job_id":"15e00fce-d53c-4b2c-b8d5-1d2bd264c240","html_url":"https://github.com/zio/zio-schema","commit_stats":null,"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"purl":"pkg:github/zio/zio-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zio","download_url":"https://codeload.github.com/zio/zio-schema/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fzio-schema/sbom","scorecard":{"id":702319,"data":{"date":"2025-07-21","repo":{"name":"github.com/zio/zio-schema","commit":"43411a031200cad1817b8e20b94802bd255b33ec"},"scorecard":{"version":"v5.2.1-24-gc29a04d4","commit":"c29a04d46d1570393e94662bc34e9906398e1bfa"},"score":5.5,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 3/7 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/auto-approve.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/release-drafter.yml:1","Warn: topLevel 'contents' permission set to 'write': .github/workflows/scala-steward.yml:10","Warn: no topLevel permission defined: .github/workflows/site.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/auto-approve.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/auto-approve.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:89: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release-drafter.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/release-drafter.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scala-steward.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/scala-steward.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/scala-steward.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/scala-steward.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/site.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/site.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/zio/zio-schema/site.yml/main?enable=pin","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of  14 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#security-policy"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yml:83"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/c29a04d46d1570393e94662bc34e9906398e1bfa/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T05:27:40.767Z","repository_id":37000072,"created_at":"2025-08-22T05:27:40.767Z","updated_at":"2025-08-22T05:27:40.767Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29193099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["avro","bson","json","msg-pack","protobuf","scala","thrift","zio"],"created_at":"2024-11-10T22:16:16.250Z","updated_at":"2026-03-08T11:06:56.841Z","avatar_url":"https://github.com/zio.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)\n[//]: # (So please do not edit it manually. Instead, change \"docs/index.md\" file or sbt setting keys)\n[//]: # (e.g. \"readmeDocumentation\" and \"readmeSupport\".)\n\n# ZIO Schema\n\n[ZIO Schema](https://github.com/zio/zio-schema) is a [ZIO](https://zio.dev)-based library for modeling the schema of data structures as first-class values.\n\n[![Development](https://img.shields.io/badge/Project%20Stage-Development-green.svg)](https://github.com/zio/zio/wiki/Project-Stages) ![CI Badge](https://github.com/zio/zio-schema/workflows/CI/badge.svg) [![Sonatype Releases](https://img.shields.io/nexus/r/https/oss.sonatype.org/dev.zio/zio-schema_2.13.svg?label=Sonatype%20Release)](https://oss.sonatype.org/content/repositories/releases/dev/zio/zio-schema_2.13/) [![Sonatype Snapshots](https://img.shields.io/nexus/s/https/oss.sonatype.org/dev.zio/zio-schema_2.13.svg?label=Sonatype%20Snapshot)](https://oss.sonatype.org/content/repositories/snapshots/dev/zio/zio-schema_2.13/) [![javadoc](https://javadoc.io/badge2/dev.zio/zio-schema-docs_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/zio-schema-docs_2.13) [![ZIO Schema](https://img.shields.io/github/stars/zio/zio-schema?style=social)](https://github.com/zio/zio-schema)\n\n## Introduction\n\nZIO Schema helps us to solve some of the most common problems in distributed computing, such as serialization, deserialization, and data migration.\n\nIt turns a compiled-time construct (the type of a data structure) into a runtime construct (a value that can be read, manipulated, and composed at runtime). A schema is a structure of a data type. ZIO Schema reifies the concept of structure for data types. It makes a high-level description of any data type and makes them first-class values.\n\nCreating a schema for a data type helps us to write codecs for that data type. So this library can be a host of functionalities useful for writing codecs and protocols like JSON, Protobuf, CSV, and so forth.\n\n## What Problems Does ZIO Schema Solve?\n\nWith schema descriptions that can be automatically derived for case classes and sealed traits, _ZIO Schema_ will be going to provide powerful features for free:\n\n1. Metaprogramming without macros, reflection, or complicated implicit derivations.\n    1. Creating serialization and deserialization codecs for any supported protocol (JSON, Protobuf, etc.)\n    2. Deriving standard type classes (`Eq`, `Show`, `Ordering`, etc.) from the structure of the data\n    3. Default values for data types\n2. Automate ETL (Extract, Transform, Load) pipelines\n    1. Diffing: diffing between two values of the same type\n    2. Patching: applying a diff to a value to update it\n    3. Migration: migrating values from one type to another\n3. Computations as data: Not only we can turn types into values, but we can also turn computations into values. This opens up a whole new world of possibilities concerning distributed computing.\n\nWhen our data structures need to be serialized, deserialized, persisted, or transported across the wire, then _ZIO Schema_ lets us focus on data modeling and automatically tackle all the low-level, messy details for us.\n\n_ZIO Schema_ is used by a growing number of ZIO libraries, including [ZIO Flow](https://zio.dev/zio-flow), [ZIO Redis](https://zio-redis), [ZIO SQL](https://zio.dev/zio-sql) and [ZIO DynamoDB](https://zio.dev/zio-dynamodb).\n\n## Installation\n\nIn order to use this library, we need to add the following lines in our `build.sbt` file:\n\n```scala\nlibraryDependencies += \"dev.zio\" %% \"zio-schema\"          % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-avro\"     % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-bson\"     % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-json\"     % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-msg-pack\" % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-protobuf\" % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-thrift\"   % \"1.8.2\"\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-zio-test\" % \"1.8.2\"\n\n// Required for the automatic generic derivation of schemas\nlibraryDependencies += \"dev.zio\" %% \"zio-schema-derivation\" % \"1.8.2\"\nlibraryDependencies += \"org.scala-lang\" % \"scala-reflect\"  % scalaVersion.value % \"provided\"\n```\n\n## Example\n\nIn this simple example first, we create a schema for `Person` and then run the _diff_ operation on two instances of the `Person` data type, and finally, we encode a Person instance using _Protobuf_ protocol:\n\n```scala\nimport zio._\nimport zio.stream._\nimport zio.schema.codec.{BinaryCodec, ProtobufCodec}\nimport zio.schema.{DeriveSchema, Schema}\n\nimport java.io.IOException\n\nfinal case class Person(name: String, age: Int)\n\nobject Person {\n  implicit val schema: Schema[Person]    = DeriveSchema.gen\n  val protobufCodec: BinaryCodec[Person] = ProtobufCodec.protobufCodec\n}\n\nobject Main extends ZIOAppDefault {\n  def run: ZIO[Any, IOException, Unit] =\n    ZStream\n      .succeed(Person(\"John\", 43))\n      .via(Person.protobufCodec.streamEncoder)\n      .runCollect\n      .flatMap(x =\u003e\n        Console.printLine(s\"Encoded data with protobuf codec: ${toHex(x)}\")\n      )\n\n  def toHex(chunk: Chunk[Byte]): String =\n    chunk.map(\"%02X\".format(_)).mkString\n}\n```\n\nHere is the output of running the above program:\n\n```scala\nEncoded data with protobuf codec: 0A044A6F686E102B\n```\n\n## Resources\n\n- [Zymposium - ZIO Schema](https://www.youtube.com/watch?v=GfNiDaL5aIM) by John A. De Goes, Adam Fraser, and Kit Langton (May 2021)\n- [ZIO SCHEMA: A Toolkit For Functional Distributed Computing](https://www.youtube.com/watch?v=lJziseYKvHo\u0026t=481s) by Dan Harris (Functional Scala 2021)\n- [Creating Declarative Query Plans With ZIO Schema](https://www.youtube.com/watch?v=ClePN4P9_pg) by Dan Harris (ZIO World 2022)\n- [Describing Data...with free applicative functors (and more)](https://www.youtube.com/watch?v=oRLkb6mqvVM) by Kris Nuttycombe (Scala World) on the idea behind the [xenomorph](https://github.com/nuttycom/xenomorph) library\n\n## Documentation\n\nLearn more on the [ZIO Schema homepage](https://zio.dev/zio-schema)!\n\n## Contributing\n\nFor the general guidelines, see ZIO [contributor's guide](https://zio.dev/contributor-guidelines).\n#### TL;DR\n\nBefore you submit a PR, make sure your tests are passing, and that the code is properly formatted\n\n```\nsbt prepare\n\nsbt test\n```\n\n## Code of Conduct\n\nSee the [Code of Conduct](https://zio.dev/code-of-conduct)\n\n## Support\n\nCome chat with us on [![Badge-Discord]][Link-Discord].\n\n[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord \"chat on discord\"\n[Link-Discord]: https://discord.gg/2ccFBr4 \"Discord\"\n\n## License\n\n[License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fzio-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzio%2Fzio-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fzio-schema/lists"}