{"id":13610997,"url":"https://github.com/nesk/akkurate","last_synced_at":"2025-04-10T01:15:32.396Z","repository":{"id":192091400,"uuid":"637408735","full_name":"nesk/akkurate","owner":"nesk","description":"The expressive validation library for Kotlin","archived":false,"fork":false,"pushed_at":"2025-01-27T13:14:17.000Z","size":1018,"stargazers_count":383,"open_issues_count":11,"forks_count":13,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-10T01:15:22.454Z","etag":null,"topics":["constraints","dsl","kotlin","kotlin-library","multiplatform","validation","validation-library"],"latest_commit_sha":null,"homepage":"https://akkurate.dev","language":"Kotlin","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/nesk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-05-07T13:22:50.000Z","updated_at":"2025-04-06T02:21:00.000Z","dependencies_parsed_at":"2023-09-02T14:03:56.443Z","dependency_job_id":"d2f3b0a9-37fa-4d8b-8c91-6dfa97864f08","html_url":"https://github.com/nesk/akkurate","commit_stats":{"total_commits":200,"total_committers":2,"mean_commits":100.0,"dds":"0.0050000000000000044","last_synced_commit":"9d26d780595fa792856dc1e1bc2c62dc97000692"},"previous_names":["nesk/akkurate"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fakkurate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fakkurate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fakkurate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nesk%2Fakkurate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nesk","download_url":"https://codeload.github.com/nesk/akkurate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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":["constraints","dsl","kotlin","kotlin-library","multiplatform","validation","validation-library"],"created_at":"2024-08-01T19:01:50.683Z","updated_at":"2025-04-10T01:15:32.373Z","avatar_url":"https://github.com/nesk.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Akkurate\n\n[**Get started by reading the documentation**](https://akkurate.dev)\n\nAkkurate is a validation library taking advantage of the expressive power of Kotlin. No need \\\nfor 30+ annotations or complicated custom constraints; write your validation code in Kotlin with a beautiful declarative\nAPI.\n\nDesigned from scratch to handle complex business logic, its role is to help you write qualitative and maintainable\nvalidation code.\n\n\u003cimg src=\"documentation/images/social.png\" max-width=700 max-height=350 alt=\"A code example of Akkurate used to showcase the library on social networks.\" /\u003e\n\n\u003e [!WARNING]\n\u003e Akkurate is under development and, despite being heavily tested, its API isn't yet stabilized; _breaking changes\n\u003e might happen on minor releases._ However, we will always provide migration guides.\n\u003e\n\u003e Report any issue or bug \u003ca href=\"/issues\"\u003ein the GitHub repository.\u003c/a\u003e\n\n## Showcase\n\nHere's an example showcasing how you can constrain a book and its list of authors.\n\n```kotlin\n// Define your classes\n\n@Validate\ndata class Book(\n    val title: String,\n    val releaseDate: LocalDateTime,\n    val authors: List\u003cAuthor\u003e,\n)\n\n@Validate\ndata class Author(val firstName: String, val lastName: String)\n\n// Write your validation rules\n\nval validateBook = Validator\u003cBook\u003e {\n    // First the property, then the constraint, finally the message.\n    title.isNotEmpty() otherwise { \"Missing title\" }\n\n    releaseDate.isInPast() otherwise { \"Release date must be in past\" }\n\n    authors.hasSizeBetween(1..10) otherwise { \"Wrong author count\" }\n\n    authors.each { // Apply constraints to each author\n        (firstName and lastName) {\n            // Apply the same constraint to both properties\n            isNotEmpty() otherwise { \"Missing name\" }\n        }\n    }\n}\n\n// Validate your data\n\nwhen (val result = validateBook(someBook)) {\n    is Success -\u003e println(\"Success: ${result.value}\")\n    is Failure -\u003e {\n        val list = result.violations\n            .joinToString(\"\\n\") { \"${it.path}: ${it.message}\" }\n        println(\"Failures:\\n$list\")\n    }\n}\n```\n\nNotice how each constraint applied to a property can be read like a sentence. This code:\n\n```kotlin\ntitle.isNotEmpty() otherwise { \"Missing title\" }\n```\n\ncan be read:\n\n```text\nCheck if 'title' is not empty otherwise write \"Missing title\".\n```\n\n## Features\n\n- [**Beautiful DSL and API**](https://akkurate.dev/docs/harness-the-dsl.html) \\\n  Write crystal clear validation code and keep it \u003ctooltip term=\"DRY\"\u003eDRY\u003c/tooltip\u003e. Use loops and conditions when\n  needed; forget about annotation hell.\n\n- [**Bundled with all the essential constraints**](https://akkurate.dev/docs/apply-constraints.html) \\\n  Write custom constraints for your business logic and nothing more. The rest? It's on us!\n\n- [**Easily and highly extendable**](https://akkurate.dev/docs/extend.html) \\\n  No need to write verbose code to create custom constraints, within Akkurate they're as simple as a lambda with\n  parameters.\n\n- [**Contextual and asynchronous**](https://akkurate.dev/docs/use-external-sources.html) \\\n  Query sync/async data sources whenever you need to, like a database, or a REST API. Everything can happen inside\n  validation.\n\n- [**Integrated with your favorite tools**](https://akkurate.dev/docs/integrations.html) \\\n  Validate your data within any popular framework, we take care of the integrations for you.\n\n- [**Code once, deploy everywhere**](https://akkurate.dev/docs/getting-started.html#installation) \\\n  Take advantage of Kotlin Multiplatform; write your validation code once, use it both for front-end and back-end\n  usages.\n\n- [**Testable out of the box**](https://akkurate.dev/docs/extend.html#test-your-code) \\\n  Finding how to test your validation code shouldn't be one of your tasks. You will find all the tools you need to write\n  good tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesk%2Fakkurate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnesk%2Fakkurate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnesk%2Fakkurate/lists"}