{"id":16178989,"url":"https://github.com/f43nd1r/autodsl","last_synced_at":"2026-01-17T16:27:35.891Z","repository":{"id":36995919,"uuid":"358948300","full_name":"F43nd1r/autodsl","owner":"F43nd1r","description":"Auto-generate DSLs for Kotlin using annotations","archived":false,"fork":false,"pushed_at":"2024-10-24T02:04:46.000Z","size":480,"stargazers_count":41,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-24T18:25:31.466Z","etag":null,"topics":["code-generation","dsl","kapt","kotlin","kotlin-symbol-processor"],"latest_commit_sha":null,"homepage":"","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/F43nd1r.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}},"created_at":"2021-04-17T18:02:22.000Z","updated_at":"2024-10-24T02:04:40.000Z","dependencies_parsed_at":"2023-10-23T15:00:53.581Z","dependency_job_id":"5a742df3-3689-4acf-a80b-048845eb8806","html_url":"https://github.com/F43nd1r/autodsl","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F43nd1r%2Fautodsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F43nd1r%2Fautodsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F43nd1r%2Fautodsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/F43nd1r%2Fautodsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/F43nd1r","download_url":"https://codeload.github.com/F43nd1r/autodsl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221662781,"owners_count":16859748,"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":["code-generation","dsl","kapt","kotlin","kotlin-symbol-processor"],"created_at":"2024-10-10T05:25:06.582Z","updated_at":"2026-01-17T16:27:35.849Z","avatar_url":"https://github.com/F43nd1r.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://img.shields.io/maven-central/v/com.faendir.kotlin.autodsl/processor?style=for-the-badge)](https://search.maven.org/search?q=com.faendir.kotlin.autodsl)\n\n\n# AutoDSL for Kotlin\n\nAuto-generates [DSL (Domain Specific Language)](https://en.wikipedia.org/wiki/Domain-specific_language)\nfor your Kotlin projects using annotations.\n\nInspired by [AutoDsl](https://github.com/juanchosaravia/autodsl), which is no longer maintained.\n\n## Documentation\n\nCreate expressive, immutable and type-safe DSL **without boilerplate code**:\n\n```kotlin\nperson {\n    name = \"Juan\"\n    age = 34\n    address {\n        street = \"200 Celebration Bv\"\n        zipCode = 34747\n        location {\n            lat = 100.0\n            lng = 100.0\n        }\n    }\n    friend {\n        name = \"Arturo\"\n        age = 28\n    }\n    friend {\n        name = \"Tiwa\"\n        age = 30\n    }\n}\n```\n\nTo generate the previous DSL you just need to provide your desired classes with `@AutoDsl`:\n\n```kotlin\n@AutoDsl\nclass Person(\n    val name: String,\n    val age: Int,\n    val address: Address?,\n    val friends: List\u003cPerson\u003e = emptyList(),\n    //in some cases you'll need to provide a valid singular form manually\n    @AutoDslSingular(\"clazz\")\n    val classes: List\u003cPerson\u003e = emptyList()\n)\n\n\n@AutoDsl\ndata class Address(\n    val street: String,\n    val zipCode: Int,\n    val location: Location?\n)\n\n@AutoDsl\nclass Location {\n    val lat: Double\n    val lng: Double\n\n    constructor() {\n        lat = 0.0\n        lng = 0.0\n    }\n\n    // with multiple constructors you can specify which one to use.\n    @AutoDslConstructor\n    constructor(lat: Double, lng: Double) {\n        this.lat = lat\n        this.lng = lng\n    }\n}\n```\nAutoDsl will be generating a builder class and extension function for the annotated class providing this super expressive DSL.\n\nFor required parameters like `name` the DSL will throw an exception at runtime. To make it optional just set the property as nullable with the question mark like `address`, or provide a default value like `friends`. The value will be null in case it's not set.\n\nFor inspections on required parameters use [this IntelliJ plugin](https://plugins.jetbrains.com/plugin/16644-kotlin-autodsl-inspections).\n\n **Default values are supported!**\n \n## Usage\n\nYou can use either ksp or kapt to run this processor. See [here](https://kotlinlang.org/docs/ksp-why-ksp.html#comparison-to-kapt) for a comparison of ksp and kapt.\n\n 1.a) Add dependencies ([Kotlin Symbol Processing (KSP)](https://github.com/google/ksp)):\n\nsettings.gradle.kts:\n```kotlin\npluginManagement {\n    repositories {\n       gradlePluginPortal()\n       google() //required for ksp\n    }\n}\n```\n\nbuild.gradle.kts:\n```kotlin\nplugins {\n    id(\"com.google.devtools.ksp\") version \"\u003clatest ksp version\u003e\" //check https://github.com/google/ksp/releases\n}\n\nrepositories {\n    mavenCentral()\n    google()\n}\n\ndependencies {\n    val autoDslVersion = \"\u003clatest version\u003e\" //check https://github.com/F43nd1r/autodsl-ksp/releases\n    implementation(\"com.faendir.kotlin.autodsl:annotations:$autoDslVersion\")\n    ksp(\"com.faendir.kotlin.autodsl:processor:$autoDslVersion\")\n}\n```\n\n 1.b) Add dependencies ([KAPT](https://kotlinlang.org/docs/kapt.html)):\n\nbuild.gradle.kts:\n```kotlin\nplugins {\n    kotlin(\"kapt\") version \"1.5.0\"\n}\n\nrepositories {\n    mavenCentral()\n    google()\n}\n\ndependencies {\n    val autoDslVersion = \"\u003clatest version\u003e\" //check https://github.com/F43nd1r/autodsl/releases\n    implementation(\"com.faendir.kotlin.autodsl:annotations:$autoDslVersion\")\n    kapt(\"com.faendir.kotlin.autodsl:processor:$autoDslVersion\")\n}\n```\n\n 2. Add `@AutoDsl` to your classes and build your project\n\n 3. Enjoy your new DSL!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff43nd1r%2Fautodsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff43nd1r%2Fautodsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff43nd1r%2Fautodsl/lists"}