{"id":36419171,"url":"https://github.com/vooft/spektor","last_synced_at":"2026-04-10T12:05:51.362Z","repository":{"id":314104983,"uuid":"1039450676","full_name":"vooft/spektor","owner":"vooft","description":"Schema-first OpenAPI generator for Ktor-server","archived":false,"fork":false,"pushed_at":"2026-04-01T06:49:19.000Z","size":477,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T05:38:45.194Z","etag":null,"topics":["generator","ktor","ktor-server","openapi","schema-first","server","swagger"],"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/vooft.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":"2025-08-17T08:59:14.000Z","updated_at":"2026-04-01T06:49:08.000Z","dependencies_parsed_at":"2025-09-10T17:49:28.394Z","dependency_job_id":"c866ce5e-8fbe-40ab-8151-90cde22210ed","html_url":"https://github.com/vooft/spektor","commit_stats":null,"previous_names":["vooft/spektor"],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/vooft/spektor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vooft%2Fspektor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vooft%2Fspektor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vooft%2Fspektor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vooft%2Fspektor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vooft","download_url":"https://codeload.github.com/vooft/spektor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vooft%2Fspektor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31641493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: 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":["generator","ktor","ktor-server","openapi","schema-first","server","swagger"],"created_at":"2026-01-11T17:02:11.440Z","updated_at":"2026-04-10T12:05:51.345Z","avatar_url":"https://github.com/vooft.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build and test](https://github.com/vooft/spektor/actions/workflows/build.yml/badge.svg?branch=main)\n![Releases](https://img.shields.io/github/v/release/vooft/spektor)\n![Gradle Plugin Portal Version](https://img.shields.io/gradle-plugin-portal/v/io.github.vooft.spektor)\n![License](https://img.shields.io/github/license/vooft/spektor)\n\n## Spektor - Ktor server code generation from OpenAPI specification\n\nSpector is a Gradle plugin that generates Ktor server code from OpenAPI specification.\nIt generates a strongly typed API interface and routing code that can be used to implement the server logic.\nAlso, unified OpenAPI spec YAML is generated from all given specifications. It's placed into the `resources` of the\ngenerated source with the same dir structure as `specRoot` is relative to your sources set `resources`.\n\nBoth Ktor 2 and Ktor 3 are supported.\n\n## Usage\n\n### Gradle plugin\n\nAdd the spektor plugin to your build file:\n\n```kotlin\nplugins {\n    id(\"io.github.vooft.spektor\") version \"\u003cversion\u003e\"\n}\n```\n\nLatest version could be found on [Gradle plugins portal](https://plugins.gradle.org/plugin/io.github.vooft.spektor).\n\n### Generator configuration\n\n```kotlin\nspektor {\n    // this is the only required parameter, all *.yaml files with paths will be processed\n    specRoot = file(\"src/main/resources/openapi\")\n\n    // base api for all generated classes, rest of the package will be generated from the spec file path\n    // default is \"spektor.example\"\n    basePackage = \"com.example.api\"\n\n    // suffix for generated DTO classes\n    // optional default is \"Dto\"\n    dtoSuffix = \"Dto\"\n\n    // suffix for generated API interface and Routes class\n    // optional default is \"ServerApi\"\n    serverApiSuffix = \"ServerApi\"\n\n    // suffix for generated Routes class\n    // optional default is \"Routes\"\n    routesSuffix = \"Routes\"\n\n    // create unified spec from all provided specs, could be used without arguments, i.e. createUnifiedSpec()\n    createUnifiedSpec {\n        // name for unified .yaml spec file\n        // optional default is \"openapi\"\n        specName = \"openapi\"\n\n        // title used for unified spec\n        // optional default is \"Unified API\"\n        specTitle = \"Unified API\"\n\n        // description used for unified spec\n        // optional default is \"Unified API\"\n        specDescription = \"Unified API\"\n\n        // server urls used for unified spec\n        // optional default is empty list\n        specServers.add(\"https://example.com\")\n\n        // fail gradle :spektorMerge task if there was an error during spec unification\n        // if disabled, error will still be logged\n        // optional default is \"true\"\n        failOnMergeError = true\n    }\n\n    // optional class names substitutions\n    substitutions {\n        // replace a class for a whole DTO, provided class will be used everywhere the model is referenced\n        ref {\n            file = file(\"src/main/resources/openapi/models/money.yaml\")\n            model = \"Money\"\n        } with \"io.github.vooft.spektor.sample.models.Money\"\n\n        // replace a class for a specific property of a model, provided class will be used only for that property\n        microtype {\n            file = file(\"src/main/resources/openapi/models/book.yaml\")\n            model = \"Book\"\n            property = \"id\"\n        } with \"io.github.vooft.spektor.sample.models.BookId\"\n    }\n}\n```\n\n### Generated code structure\n\nSince Ktor is not a declarative framework, `spektor` adds a layer of abstraction to make it easier to implement the\nserver logic.\n\nFor every OpenAPI tag, it will generate at least 2 classes (using Author example):\n\n* `AuthorServerApi` - an interface with methods for every operation in the tag.\n  The method parameters and return types are strongly typed using generated DTO classes.\n  This interface should be implemented to provide the server logic.\n* `AuthorRoutes` - a class with methods to create Ktor routes for every operation in the tag.\n  This class takes an instance of `AuthorServerApi` in the constructor and uses it to handle the requests.\n  The methods in this class should be used in the Ktor routing DSL.\n\nRoutes class is generated to be able to configure custom interceptors, authentication, etc when configuring the Ktor\nroutes.\n\nPlease see full example in [spektor-sample](./spektor-sample):\n\n* Implementation of the ServerApi\n  interface: [AuthorRestService.kt](./spektor-sample/src/main/kotlin/io/github/vooft/spektor/sample/apis/AuthorRestService.kt) --\n  implements a generated class for the Author rest API, generated\n  from [author.yaml](./spektor-sample/src/main/resources/openapi/api/author.yaml)\n* Using the generated Routes class in Ktor\n  routing: [Routing.kt](./spektor-sample/src/main/kotlin/io/github/vooft/spektor/sample/ktor/Routing.kt) -- uses the\n  generated `AuthorRoutes` class to create Ktor routes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvooft%2Fspektor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvooft%2Fspektor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvooft%2Fspektor/lists"}