{"id":20410598,"url":"https://github.com/acanda/fabrikt-gradle-plugin","last_synced_at":"2026-04-19T21:15:03.188Z","repository":{"id":215784851,"uuid":"687155869","full_name":"acanda/fabrikt-gradle-plugin","owner":"acanda","description":"Fabrikt Gradle Plugin: generates Kotlin code from an OpenAPI 3 specification.","archived":false,"fork":false,"pushed_at":"2026-04-19T19:19:42.000Z","size":979,"stargazers_count":26,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-19T19:33:18.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/acanda.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":null,"dco":null,"cla":null}},"created_at":"2023-09-04T18:43:23.000Z","updated_at":"2026-04-19T19:19:37.000Z","dependencies_parsed_at":"2024-03-22T21:44:04.516Z","dependency_job_id":"57f16f34-979f-47bd-8e21-a6ba7bc0d1ea","html_url":"https://github.com/acanda/fabrikt-gradle-plugin","commit_stats":null,"previous_names":["acanda/fabrikt-gradle-plugin"],"tags_count":64,"template":false,"template_full_name":null,"purl":"pkg:github/acanda/fabrikt-gradle-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acanda%2Ffabrikt-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acanda%2Ffabrikt-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acanda%2Ffabrikt-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acanda%2Ffabrikt-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acanda","download_url":"https://codeload.github.com/acanda/fabrikt-gradle-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acanda%2Ffabrikt-gradle-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32022860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"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":"2024-11-15T05:47:14.363Z","updated_at":"2026-04-19T21:15:03.181Z","avatar_url":"https://github.com/acanda.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fabrikt Gradle Plugin\n\nThe Fabrikt Gradle Plugin integrates Fabrikt into your Gradle builds.\n[Fabrikt](https://github.com/cjbooms/fabrikt) generates Kotlin code from an OpenAPI 3 specification.\nIt supports data classes with advanced features, Spring or Micronaut controllers,\nKtor route handlers, and OkHttp or OpenFeign clients.\n\nThis plugin can be permanently integrated into your Gradle build and will ensure\ncontract and code always match, even as your APIs evolve in complexity.\n\n## Usage\n\n[![Gradle Plugin Portal Version](https://img.shields.io/gradle-plugin-portal/v/ch.acanda.gradle.fabrikt?style=flat)](https://plugins.gradle.org/plugin/ch.acanda.gradle.fabrikt)\n\nThe plugin requires at least Gradle 9.0 and a JRE 21.\nIf you are using Gradle 8.x, you can use version 1.18.0 of the plugin.\n\nTo use it with the Kotlin DSL (build.gradle.kts):\n\n```kotlin\nplugins {\n    id(\"ch.acanda.gradle.fabrikt\") version \"1.32.0\"\n}\n\nfabrikt {\n    generate(\"dog\") {\n        apiFile = file(\"src/main/openapi/dog.yaml\")\n        basePackage = \"com.example.api\"\n    }\n}\n```\n\nTo use it with the Groovy DSL (build.gradle):\n\n```groovy\nplugins {\n    id 'ch.acanda.gradle.fabrikt' version '1.32.0'\n}\n\nfabrikt {\n    dog {\n        apiFile = file('src/main/openapi/dog.yaml')\n        basePackage = 'com.example.api'\n    }\n}\n```\n\n\u003e Note: some configuration options are reserved words or type names that are\n\u003e imported by Groovy by default, so you have to prefix them with `owner.`.\n\u003e ```groovy\n\u003e typeOverrides {\n\u003e   binary = owner.InputStream\n\u003e   owner.'byte' = owner.String\n\u003e   datetime = owner.Instant\n\u003e }\n\u003e ```\n\nWhen running `gradle fabriktGenerate`, the examples above will generate the\nmodel classes from the OpenAPI specification in `src/main/openapi/dog.yaml`. The\nmodel classes will be generated in\n`build/generated/sources/fabrikt/src/main/kotlin/`.\n\nThe plugin provides the following tasks:\n\n- `fabriktGenerate`: generates code for all configurations, unless they have\n  `skip` set to  `true`.\n- `fabriktGenerate[Name]`: generates code for the configuration with the\n  specified name. The suffix `[Name]` is derived from the configuration´s name\n  by removing non-alphanumeric characters and converting the rest to CamelCase.\n  E.g. the code for the configuration `generate(\"dog-api\") { ... }` can be generated\n  with `gradle fabriktGenerateDogApi`.\n\n## Configuration\n\n```kotlin\nplugins {\n    id(\"ch.acanda.gradle.fabrikt\") version \"1.32.0\"\n    // If you are using IntelliJ IDEA, the plugin will automatically add the\n    // output directory as a generated sources directory.\n    idea\n}\n\nfabrikt {\n    generate(\"dog\") {\n        // mandatory properties\n        apiFile = file(\"src/main/openapi/dog.yaml\")\n        basePackage = \"com.example.dog.api\"\n        // optional properties with their default values\n        apiFragments = files()\n        externalReferenceResolution = targeted\n        outputDirectory = file(\"build/generated/sources/fabrikt\")\n        sourcesPath = \"src/main/kotlin\"\n        resourcesPath = \"src/main/resources\"\n        validationLibrary = Javax\n        quarkusReflectionConfig = enabled\n        addFileDisclaimer = disabled\n        typeOverrides {\n            datetime = OffsetDateTime\n            byte = ByteArray\n            binary = ByteArray\n            uri = URI\n            uuid = UUID\n            date = LocalDate\n        }\n        client {\n            generate = disabled\n            target = OkHttp\n            resilience4j = disabled\n            suspendModifier = disabled\n            springResponseEntityWrapper = disabled\n            springCloudOpenFeignStarterAnnotation = disabled\n            openFeignClientName = \"fabrikt-client\"\n        }\n        controller {\n            generate = disabled\n            authentication = disabled\n            groupByTag = disabled\n            suspendModifier = disabled\n            completionStage = disabled\n            target = Spring\n        }\n        model {\n            generate = enabled\n            extensibleEnums = disabled\n            javaSerialization = disabled\n            quarkusReflection = disabled\n            micronautIntrospection = disabled\n            micronautReflection = disabled\n            micronautSerdeable = disabled\n            includeCompanionObject = disabled\n            sealedInterfacesForOneOf = disabled\n            faultTolerantEnums = disabled\n            ignoreUnknownProperties = disabled\n            serializationLibrary = Jackson\n            jacksonNullabilityMode = None\n            instantLibrary = Kotlinx\n        }\n        skip = false\n    }\n}\n```\n\n| Property                                     | Description                                                                                                                                                                                                                                                                                                                        | Default value                     |\n|----------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|\n| apiFile                                      | The path to an Open API v3 specification, interpreted relative to the project directory.                                                                                                                                                                                                                                           |                                   |\n| apiFragments                                 | A set of paths to Open API v3 specification fragments, interpreted relative to the project directory.                                                                                                                                                                                                                              | `files()`                         |\n| externalReferenceResolution                  | Specify to which degree referenced schemas from external files are included in model generation. `targeted` generates models only for directly referenced schemas in external API files. `aggressive` triggers generation of every external schema in a file containing a referenced schema.\u003cbr/\u003eValues: `targeted`, `aggressive`. | `targeted`                        |\n| basePackage                                  | The base package under which all code is built.                                                                                                                                                                                                                                                                                    |                                   |\n| outputDirectory                              | The directory to which the generated classes are written, interpreted relative to the project directory.                                                                                                                                                                                                                           | `build/generated/sources/fabrikt` |\n| sourcesPath                                  | The path for generated source files, interpreted relative to the output directory.                                                                                                                                                                                                                                                 | `src/main/kotlin`                 |\n| resourcesPath                                | The path for generated resource files, interpreted relative to the output directory.                                                                                                                                                                                                                                               | `src/main/resources`              |\n| typeOverrides.datetime                       | Specifies the Kotlin type for the OAS type `datetime`.\u003cbr/\u003eValues: `OffsetDateTime`, `Instant`, `LocalDateTime`.                                                                                                                                                                                                                   | `OffsetDateTime`                  |\n| typeOverrides.byte                           | Specifies the Kotlin type for the OAS type `string` with format `byte`.\u003cbr/\u003eValues: `ByteArray`, `String`.                                                                                                                                                                                                                         | `ByteArray`                       |\n| typeOverrides.binary                         | Specifies the Kotlin type for the OAS type `string` with format `binary`.\u003cbr/\u003eValues: `ByteArray`, `InputStream`, `String`.                                                                                                                                                                                                        | `ByteArray`                       |\n| typeOverrides.uri                            | Specifies the Kotlin type for the OAS type `string` with format `uri`.\u003cbr/\u003eValues: `URI`, `String`.                                                                                                                                                                                                                                | `URI`                             |\n| typeOverrides.uuid                           | Specifies the Kotlin type for the OAS type `string` with format `uuid`.\u003cbr/\u003eValues: `UUID`, `String`.                                                                                                                                                                                                                              | `UUID`                            |\n| typeOverrides.date                           | Specifies the Kotlin type for the OAS type `string` with format `date`.\u003cbr/\u003eValues: `LocalDate`, `String`.                                                                                                                                                                                                                         | `LocalDate`                       |\n| validationLibrary                            | Specifies the validation library used for annotations in generated model classes.\u003cbr/\u003eValues: `Javax`, `Jakarta`, `NoValidation`.                                                                                                                                                                                                  | `Jakarta`                         |\n| quarkusReflectionConfig                      | Enables generating the reflection-config.json file for quarkus integration projects.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                           | `enabled`                         |\n| addFileDisclaimer                            | Enables adding a disclaimer to the generated files.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                            | `disabled`                        |\n| client.generate                              | Enables generating the http client code.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                                       | `disabled`                        |\n| client.target                                | The type of client you want to be generated.\u003cbr/\u003e`OkHttp`, `OpenFeign`, `SpringHttpInterface`, `Ktor`.                                                                                                                                                                                                                             | `OkHttp`                          |\n| client.resilience4j                          | Generates a fault tolerance service for the client using the following library \"io.github.resilience4j:resilience4j-all:+\". Only for OkHttp clients.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                           | `disabled`                        |\n| client.suspendModifier                       | Enables adding the suspend modifier to the generated client functions. Only for OpenFeign clients.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                             | `disabled`                        |\n| client.springResponseEntityWrapper           | Enables adding the Spring-ResponseEntity generic around the response to be able to get response headers and status (only for target `OpenFeign`).\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                              | `disabled`                        |\n| client.springCloudOpenFeignStarterAnnotation | Enables adding the the `@FeignClient` annotation to generated client interface (only for target `OpenFeign`).\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                  | `disabled`                        |\n| client.openFeignClientName                   | Specifies the OpenFeign client name for `spring-cloud-starter-openfeign` (only for target `OpenFeign`).                                                                                                                                                                                                                            | `fabrikt-client`                  |\n| controller.generate                          | Enables generating the http controller code.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                                   | `disabled`                        |\n| controller.authentication                    | Enables adding the authentication parameter to the generated controller functions.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                             | `disabled`                        |\n| controller.groupByTag                        | Enables grouping controllers based on the first tag rather than paths.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                         | `disabled`                        |\n| controller.suspendModifier                   | Enables adding the suspend modifier to the generated controller functions.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                     | `disabled`                        |\n| controller.completionStage                   | Enables the generated controller functions to have type CompletionStage (only for target `Spring`).\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                            | `disabled`                        |\n| controller.target                            | The target framework tor the controllers you want to be generated.\u003cbr/\u003eValues: `Spring`, `Micronaut`, `Ktor`.                                                                                                                                                                                                                      | `Spring`                          |\n| model.generate                               | Enables generating the http model code.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                                        | `enabled`                         |\n| model.extensibleEnums                        | Enables treating x-extensible-enums as enums.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                                  | `disabled`                        |\n| model.javaSerialization                      | Enables adding the Java `Serializable` interface to the generated models.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                      | `disabled`                        |\n| model.quarkusReflection                      | Enables adding `@RegisterForReflection` to the generated models.\u003cbr/\u003eRequires the dependency `io.quarkus:quarkus-core:+`.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                      | `disabled`                        |\n| model.micronautIntrospection                 | Enables adding `@Introspected` to the generated models.\u003cbr/\u003eRequires the dependency `io.micronaut:micronaut-core:+`.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                           | `disabled`                        |\n| model.micronautReflection                    | Enables adding `@ReflectiveAccess` to the generated models.\u003cbr/\u003eRequires the dependency `io.micronaut:micronaut-core:+`.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                       | `disabled`                        |\n| model.micronautSerdeable                     | Enables adding `@Serdeable` to the generated models.\u003cbr/\u003eRequires the dependency `io.micronaut.serde:micronaut-serde-jackson:+`.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                               | `disabled`                        |\n| model.includeCompanionObject                 | Enables adding a companion object to the generated models.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                                     | `disabled`                        |\n| model.sealedInterfacesForOneOf               | Enables the generation of sealed interfaces for discriminated `oneOf` types.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                                   | `disabled`                        |\n| model.nonNullMapValues                       | This option makes map values non-null when enabled. The default is to make map values nullable.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                | `disabled`                        |\n| model.faultTolerantEnums                     | Enables adding an `UNRECOGNIZED` enum entry as a fallback for unmapped values, preventing deserialization exceptions.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                          | `disabled`                        |\n| model.ignoreUnknownProperties                | Enables adding `@JacksonIgnoreProperties(ignoreUnknown = true)` to the generated models.\u003cbr/\u003eValues: `enabled`, `disabled`, `true`, `false`.                                                                                                                                                                                       | `disabled`                        |\n| model.suffix                                 | Specifies a custom suffix for all generated model classes.                                                                                                                                                                                                                                                                         | `null` (no suffix)                |\n| model.serializationLibrary                   | Specifies the serialization library to use for annotations in generated model classes.\u003cbr/\u003eValues: `Jackson`, `Kotlinx`.                                                                                                                                                                                                           | `Jackson`                         |\n| model.jacksonNullabilityMode                 | Specifies the handling of null values when serializing with Jackson.\u003cbr/\u003eValues: `None`, `EnforceOptionalNonNull`, `EnforceRequiredNullable`, `Strict`.                                                                                                                                                                            | `None`                            |\n| model.instantLibrary                         | Specifies the Instant library to use in generated model classes when using the `Kotlinx` serialization library.\u003cbr/\u003eValues: `Kotlinx`, `Kotlin`.                                                                                                                                                                                   | `Kotlinx`                         |\n| skip                                         | Skips generating code if set to `true` when running the task `fabriktGenerate`. Tasks generating code for a single configuration, i.e. `fabriktGenerate[Name]`, ignore this setting.\u003cbr/\u003eValues: `true`, `false`.                                                                                                                  | `false`                           |\n\n### Defaults\n\nIf you have many OpenAPI specifications with nearly the same configuration, you\ncan set the common values in the `defaults`. All properties except `apiFile` and\n`basePackage` can be configured with default values.\n\n\u003e Note: The `defaults` block is only supported in the Kotlin DSL and not in the\n\u003e Groovy DSL.\n\n```kotlin\nfabrikt {\n    defaults {\n        client {\n            generate = true\n            target = OpenFeign\n        }\n    }\n    generate(\"dog\") {\n        apiFile = file(\"src/main/openapi/dog.yaml\")\n        basePackage = \"com.example.dog.api\"\n    }\n    generate(\"cat\") {\n        apiFile = file(\"src/main/openapi/cat.yaml\")\n        basePackage = \"com.example.cat.api\"\n    }\n}\n```\n\nThe above example generates OpenFeign clients for both the dog and cat\nspecifications.\n\n## Development\n\n### Local Installation\n\nYou can use `gradle publishToMavenLocal` to install the plugin to your local\nMaven repository. Then add the local maven repository to settings.gradle.kts of\nthe project where you want to use the plugin:\n\n```kotlin\npluginManagement {\n    repositories {\n        mavenLocal()\n        // other repositories go here\n    }\n}\n```\n\n### Publish to Gradle Plugin Portal\n\nValidate the plugin:\n\n```bash\ngradle publishPlugins --validate-only\n```\n\nPublish the plugin:\n\n```bash\ngradle publishPlugins \\\n  -Pgradle.publish.key=... \\ \n  -Pgradle.publish.secret=... \\\n  -Psigning.gnupg.keyName=...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facanda%2Ffabrikt-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facanda%2Ffabrikt-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facanda%2Ffabrikt-gradle-plugin/lists"}