A KMP friendly OpenAPI parser, extension spec and Ktor-Client for Endpoint adaption and transformation at Runtime. https://code.mallne.cloud/Aviator
Find a file
Mallne 78371c8d07 Upgrade dependencies and refine Gradle scripts
Updated several dependencies including Kotlin, Ktor, and Maven Publish to newer versions. Improved Gradle scripts by replacing `properties` with `project.findProperty` for enhanced property resolution. Adjusted Gradle wrapper configurations and fixed syntax for better consistency in source set declarations.
2026-07-13 20:23:38 +02:00
.github Svelte 5 update 2024-11-25 18:26:43 +01:00
aviator-resource-server refactor: Remove redundant isDevelopment application argument and update dependencies 2026-06-05 23:23:56 +02:00
clients Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:49 +02:00
core Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:49 +02:00
gradle Upgrade dependencies and refine Gradle scripts 2026-07-13 20:23:38 +02:00
koas Upgrade dependencies and refine Gradle scripts 2026-07-02 15:06:49 +02:00
plugins Upgrade dependencies and refine Gradle scripts 2026-07-13 20:23:38 +02:00
.dockerignore Update Metadata 2025-02-03 08:17:29 +01:00
.gitignore First functional prototype 2025-01-11 23:44:26 +01:00
AGENTS.md Add published documentation hierarchy to AGENTS.md 2026-06-02 14:56:11 +02:00
build.gradle.kts Version Updates 2025-08-17 11:29:52 +02:00
gradle.properties remove deprecated Property 2026-03-12 16:16:33 +01:00
LICENSE Update Metadata 2025-01-12 00:03:28 +01:00
README.md Add Readme and Agents Files 2026-03-19 21:40:13 +01:00
settings.gradle.kts refactor: Remove TranslationKeys plugin in favor of modular adapter approach 2025-11-11 13:46:30 +01:00

Aviator ✈️

DiCentra Kotlin OpenAPI License Kotlin Multiplatform

Aviator is a modern, API-first application framework built with Kotlin Multiplatform. It empowers developers to build robust services and clients by treating the OpenAPI (OAS) specification as the single source of truth.


🚀 Overview

Aviator bridges the gap between API design and implementation. By extending the OpenAPI specification with custom x-dicentra-aviator-* attributes, the framework can automatically "materialize" declarative API operations into executable Kotlin service logic.

Why Aviator?

  • API-First: Design your API in OpenAPI and let Aviator handle the plumbing.
  • Multiplatform: Share service definitions and client logic across JVM, Android, and other KMP targets.
  • Type-Safe: Leverage Kotlin's powerful type system for your API models.
  • Extensible: A rich plugin system for authentication, interception, and content negotiation.

📦 Project Structure

The project is highly modular, allowing you to include only what you need:

Module Description
:core The heart of Aviator. Handles service conversion and plugin management.
:koas Kotlin-native models and utilities for OpenAPI 3.x specifications.
:clients Implementations for consuming Aviator services.
:plugins Extensions for various cross-cutting concerns.
:aviator-resource-server A reference Ktor server for testing and validation.

🔌 Plugins

Aviator uses a powerful plugin system to handle cross-cutting concerns. Plugins are activated during the service crystallization process.

Content Adapters

Enable support for different content types (JSON, XML) using Kotlin Serialization.

  • JsonAdapter: Provides JSON serialization support.
    plugins {
        install(JsonAdapter) {
            // Standard configuration
        }
    }
    
  • XmlAdapter: Provides XML serialization support.
    plugins {
        install(XmlAdapter) {
            // Standard configuration
        }
    }
    

Security & Middleware

  • HttpAuth: Adds support for HTTP authentication (e.g., Basic, Bearer).
    plugins {
        install(HttpAuth) {
            doBase64Encode = true
            serviceFilter = mutableListOf(ServiceLocator("my-secure-service"))
        }
    }
    
  • Interception: Allows for custom request/response interception via a staged pipeline.
    plugins {
        install(Interception) {
            steps {
                before { context -> 
                    println("Executing: ${context.serviceLocator}")
                }
            }
        }
    }
    

Advanced Integrations

  • Synapse: Facilitates communication between disparate service layers or external systems.
    plugins {
        install(Synapse) {
            active = true
        }
    }
    
  • Weaver: Integrates with the DiCentra Weaver engine for advanced data transformation and schema validation.
    plugins {
        install(Weaver) {
            weaver = myCustomWeaver
            schema = myWeaverSchema
        }
    }
    

🛰️ Clients

Aviator provides multiple client implementations to suit different environments and testing needs.

  • Ktor Client (:clients:ktor): The primary production-ready client. It uses the Ktor HTTP engine to perform real network requests based on the Aviator service definitions derived from OpenAPI. It supports full content negotiation and plugin execution.

  • Mock Client (:clients:mock): A specialized client for testing and local development. Instead of making network calls, it captures the execution context (headers, body, parameters) and allows you to simulate service responses, making it ideal for unit and integration tests.


🛠️ Getting Started

Prerequisites

  • JDK 17 or higher
  • Gradle

Building the Project

./gradlew build

Running the Test Server

To see Aviator in action, you can run the built-in resource server:

./gradlew :aviator-resource-server:run

🧩 Custom OpenAPI Extensions

Aviator uses custom extensions to map OpenAPI operations to Kotlin services:

  • x-dicentra-aviator: Specifies the version of the Aviator spec.
  • x-dicentra-aviator-serviceDelegateCall: Points to the Kotlin service implementation.
  • x-dicentra-aviator-serviceOptions: Provides configuration options for the service.
  • x-dicentra-aviator-pluginMaterialization: Configures plugins for specific routes.

📜 License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.


Built with ❤️ by Mallne under the DiCentra umbrella