{"id":46839732,"url":"https://github.com/nomasystems/ndto","last_synced_at":"2026-03-10T12:13:05.641Z","repository":{"id":58868284,"uuid":"521645583","full_name":"nomasystems/ndto","owner":"nomasystems","description":":white_check_mark: An Erlang library for DTOs validation.","archived":false,"fork":false,"pushed_at":"2025-08-26T09:37:57.000Z","size":877,"stargazers_count":25,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-25T12:03:57.306Z","etag":null,"topics":["erlang","json-schema","openapi","schema"],"latest_commit_sha":null,"homepage":"https://nomasystems.github.io/ndto/","language":"Erlang","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/nomasystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":null,"dco":null,"cla":null}},"created_at":"2022-08-05T13:19:16.000Z","updated_at":"2025-08-26T09:37:59.000Z","dependencies_parsed_at":"2023-02-13T02:50:17.226Z","dependency_job_id":"4714b631-bfd1-47b3-8803-98e372bae363","html_url":"https://github.com/nomasystems/ndto","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nomasystems/ndto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomasystems%2Fndto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomasystems%2Fndto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomasystems%2Fndto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomasystems%2Fndto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomasystems","download_url":"https://codeload.github.com/nomasystems/ndto/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomasystems%2Fndto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29006081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T04:25:24.522Z","status":"ssl_error","status_checked_at":"2026-02-02T04:24:51.069Z","response_time":58,"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":["erlang","json-schema","openapi","schema"],"created_at":"2026-03-10T12:13:05.407Z","updated_at":"2026-03-10T12:13:05.623Z","avatar_url":"https://github.com/nomasystems.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ndto\n[![CI](https://github.com/nomasystems/ndto/actions/workflows/ci.yml/badge.svg)](https://github.com/nomasystems/ndto/actions/workflows/ci.yml)\n[![Docs](https://github.com/nomasystems/ndto/actions/workflows/docs.yml/badge.svg)](https://nomasystems.github.io/ndto)\n\n`ndto` is an Erlang library for generating DTO (Data Transfer Object) validation modules from schemas.\n\n## Motivation\n\nValidating incoming data is a critical step to ensure the integrity, consistency, and security of your application's data flow. However, writing custom validation logic for each DTO can quickly become a time-consuming and error-prone task.\n\nWith `ndto`, you can define validation schemas that describe the structure and constraints of your data. These schemas are then used to automatically generate validation modules, reducing development time and avoiding human-induced errors in the validation step.\n\n## Quickstart\n\n1. Add `ndto` as a dependency in your `rebar.config` file:\n```erl\n{deps, [\n    {ndto, {git, \"https://github.com/nomasystems/ndto.git\", {branch, \"main\"}}}\n]}.\n```\n\n2. Define an `ndto` schema.\n```erl\nSchema = #{\n    type =\u003e string,\n    min_length =\u003e 8,\n    pattern =\u003e \u003c\u003c\"^hello\"\u003e\u003e\n}.\n```\n\n3. Generate a module using the `ndto:generate/2` function.\n```erl\nDTO = ndto:generate(string_schema, Schema).\n```\n\n4. Load the generated module on the fly.\n```erl\nok = ndto:load(DTO).\n```\n\n5. Call the `is_valid/1` function from the generated module to validate your data.\n```erl\ntrue = string_schema:is_valid(\u003c\u003c\"hello world\"\u003e\u003e).\n{false, _MinLengthError} = string_schema:is_valid(\u003c\u003c\"hello\"\u003e\u003e).\n{false, _PatternError} = string_schema:is_valid(\u003c\u003c\"hi world\"\u003e\u003e).\n```\n\n## `ndto` schema language\n\nSchemas are built according to the `ndto:schema()` type.\n```erl\n%%% ndto.erl\n-type schema() ::\n    empty_schema()\n    | universal_schema()\n    | ref_schema()\n    | enum_schema()\n    | boolean_schema()\n    | integer_schema()\n    | float_schema()\n    | string_schema()\n    | array_schema()\n    | object_schema()\n    | union_schema()\n    | intersection_schema()\n    | complement_schema()\n    | symmetric_difference_schema().\n```\n\nCheck the [docs](https://nomasystems.github.io/ndto/ndto.html#types) for an up-to-date version of the type specifications.\n\n## Contributing\n\nWe :heart: contributions! Please feel free to submit issues, create pull requests or just spread the word about `ndto` in the open-source community. Don't forget to check out our [contribution guidelines](CONTRIBUTING.md) to ensure smooth collaboration! :rocket:\n\n## Support\n\nIf you need help or have any questions, please don't hesitate to open an issue or contact the maintainers directly.\n\n## License\n\n`ndto` is released under the Apache 2.0 License. For more information, please see the [LICENSE](LICENSE) file.\n\u003e This project uses OpenAPI specification (OAS) schemas and examples, which are licensed under the Apache 2.0 license. See the associated [LICENSE](priv/oas/LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomasystems%2Fndto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomasystems%2Fndto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomasystems%2Fndto/lists"}