Skip to content

Commit e0e1083

Browse files
committed
chore: add architecture documentation for xap sdk
1 parent 7073bd8 commit e0e1083

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

ARCHITECTURE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# XAP SDK Architecture
2+
## Overview
3+
The XAP (Expedia Affiliate Platform) SDK is structured as a multi-module Gradle project designed to generate a Kotlin/Java SDK from OpenAPI specifications. The architecture follows a code generation approach, where API client code is automatically generated and then published to repositories for consumption by developers.
4+
5+
The repository contains the following key components:
6+
- **OpenAPI Specifications**: Defines the API endpoints, request/response models, and data types.
7+
- **Code Generation**: Utilizes OpenAPI Generator to create the SDK code based on the specifications.
8+
- **Core Integration**: Integrates with the Expedia Group's SDK platform core libraries and frameworks.
9+
- **Post-Processing**: Enhances the generated code with additional features, optimizations, and customizations.
10+
- **Publishing**: Automates the release process to make the SDK available for developers.
11+
- **Examples**: Provides sample applications demonstrating how to use the generated SDK.
12+
- **Documentation**: Contains guides and references for developers to understand and utilize the SDK effectively.
13+
- **Testing**: Includes unit, integration and end-to-end tests to ensure the correctness and reliability of the generated SDK.
14+
15+
## Technology Stack
16+
- **Languages**: Kotlin (primary), Java (compatibility)
17+
- **Build System**: Gradle with Kotlin DSL
18+
- **Code Generation**: OpenAPI Generator
19+
- **Post-Processing**: TypeScript/JavaScript (Node.js)
20+
- **CI/CD**: GitHub Actions
21+
- **Testing Frameworks**: JUnit, MockK, AssertJ
22+
- **Documentation**: Markdown, KDoc
23+
- **Version Control**: Git
24+
- **Package Management**: Maven Central, Sonatype Nexus
25+
- **Dependency Management**: Gradle Kotlin DSL
26+
- **Code Quality**: Ktlint
27+
- **Code Coverage**: Kover
28+
29+
## Modules
30+
The project is organized into several modules, each serving a specific purpose. The main modules include:
31+
32+
### `generator` module
33+
This module is responsible for the core functionality of the SDK generation process. It consumes the OpenAPI specifications and generates the initial SDK code using OpenAPI Generator. It also integrates with the `expediagroup-sdk-openapi-plugin`. The module contains the following components:
34+
- **OpenAPI Generator Configurations**: The core library that generates the SDK code from OpenAPI specifications. Lives in the `build.gradle.kts` file.
35+
- **Custom Templates**: Custom templates for generating Kotlin/Java code. Lives in the `src/main/resources/templates` directory.
36+
- **Post-Processing**: Enhancements and optimizations applied to the generated code. Lives in the `src/main/resources/post-processing` directory.
37+
38+
The generation process can be executed through the `openApiGenerate` Gradle task, which triggers the OpenAPI Generator with the specified configurations. The `openApiGenerate` gradle task workflow is as follows:
39+
1. Locates the OpenAPI specification file through the `inputSpec` environment variable, falling back to `generator/src/main/resources/specs.yaml` if not found.
40+
2. Consumes the OpenAPI specification file to generates code into the `xap-sdk/src/main/kotlin` directory.
41+
3. Generated code overrides the code present `xap-sdk/src/main/kotlin` directory, affecting only the `operations` and `models` packages.
42+
4. The generated code is then post-processed to apply additional customizations and optimizations.
43+
5. Finally, the code is formatted and linted using Ktlint to ensure code quality and consistency.

0 commit comments

Comments
 (0)