|
1 | 1 | # Overview |
| 2 | + |
2 | 3 | The XAP (Expedia API 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. |
3 | 4 |
|
4 | 5 | The repository contains the following key components: |
5 | | -- **OpenAPI Specifications**: Defines the API endpoints, request/response models, and data types. |
6 | | -- **Code Generation**: Utilizes OpenAPI Generator to create the SDK code based on the specifications. |
7 | | -- **Core Integration**: Integrates with the Expedia Group's SDK platform core libraries and frameworks. |
8 | | -- **Post-Processing**: Enhances the generated code with additional features, optimizations, and customizations. |
9 | | -- **Publishing**: Automates the release process to make the SDK available for developers. |
10 | | -- **Examples**: Provides sample applications demonstrating how to use the generated SDK. |
11 | | -- **Documentation**: Contains guides and references for developers to understand and utilize the SDK effectively. |
12 | | -- **Testing**: Includes unit, integration and end-to-end tests to ensure the correctness and reliability of the generated SDK. |
| 6 | + |
| 7 | +| Component | Description | |
| 8 | +|----------------------------|----------------------------------------------------------------------------------------------------------------| |
| 9 | +| **OpenAPI Specifications** | Defines the API endpoints, request/response models, and data types | |
| 10 | +| **Code Generation** | Utilizes OpenAPI Generator to create the SDK code based on the specifications. | |
| 11 | +| **Core Integration** | Integrates with the Expedia Group's SDK platform core libraries and frameworks | |
| 12 | +| **Post-Processing** | Enhances the generated code with additional features, optimizations, and customizations | |
| 13 | +| **Publishing Tasks** | Automates the release process to make the SDK available for developers | |
| 14 | +| **Examples** | Provides sample applications demonstrating how to use the generated SDK | |
| 15 | +| **Documentation** | Contains guides and references for developers to understand and utilize the SDK effectively | |
| 16 | +| **Testing** | Includes unit, integration and end-to-end tests to ensure the correctness and reliability of the generated SDK | |
| 17 | + |
13 | 18 |
|
14 | 19 | # Technology Stack |
15 | | -- **Languages**: Kotlin (primary), Java (compatibility) |
16 | | -- **Build System**: Gradle with Kotlin DSL |
17 | | -- **Code Generation**: OpenAPI Generator |
18 | | -- **Post-Processing**: TypeScript/JavaScript (Node.js) |
19 | | -- **CI/CD**: GitHub Actions |
20 | | -- **Testing Frameworks**: JUnit, MockK, AssertJ |
21 | | -- **Documentation**: Markdown, KDoc |
22 | | -- **Version Control**: Git |
23 | | -- **Package Management**: Maven Central, Sonatype Nexus |
24 | | -- **Dependency Management**: Gradle Kotlin DSL |
25 | | -- **Code Quality**: Ktlint |
26 | | -- **Code Coverage**: Kover |
| 20 | + |
| 21 | +| Capability | Technology | |
| 22 | +|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| |
| 23 | +| Build System | [Gradle](https://docs.gradle.org/current/userguide/userguide.html) with [Kotlin DSL](https://docs.gradle.org/current/userguide/kotlin_dsl.html) | |
| 24 | +| Code Generation | [OpenAPI Generator](https://openapi-generator.tech/) | |
| 25 | +| CI/CD | GitHub Actions | |
| 26 | +| Testing | [JUnit5](https://junit.org/junit5/) | |
| 27 | +| Version Control | Git | |
| 28 | +| Code Quality | [Kover](https://kotlin.github.io/kotlinx-kover/gradle-plugin/) | |
| 29 | +| Programming Languages | Kotlin (JVM) | |
| 30 | +| Documentation | [KDoc](https://kotlinlang.org/docs/kotlin-doc.html), [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) | |
| 31 | +| Target | [Java (LTS)](https://www.oracle.com/middleeast/java/technologies/java-se-support-roadmap.html) | |
27 | 32 |
|
28 | 33 | # Modules |
| 34 | + |
29 | 35 | The project is organized into several modules, each serving a specific purpose. The main modules include: |
30 | 36 |
|
31 | | -## `generator` module |
32 | | -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: |
33 | | -- **OpenAPI Generator Configurations**: The core library that generates the SDK code from OpenAPI specifications. Lives in the `build.gradle.kts` file. |
34 | | -- **Custom Templates**: Custom templates for generating Kotlin/Java code. Lives in the `src/main/resources/templates` directory. |
35 | | -- **Post-Processing**: Enhancements and optimizations applied to the generated code. Lives in the `src/main/resources/post-processing` directory. |
| 37 | +## Generator Module |
| 38 | + |
| 39 | +The `generator` 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`. |
| 40 | + |
| 41 | +| Generator Component/Asset | Description | |
| 42 | +|--------------------------------------|---------------------------------------------------------------------------------------------------------------------------| |
| 43 | +| **OpenAPI Generator Configurations** | The core library that generates the SDK code from OpenAPI specifications. Lives in the `build.gradle.kts` file | |
| 44 | +| **Custom Templates** | Custom templates for generating Kotlin/Java code. Lives in the `src/main/resources/templates` directory | |
| 45 | +| **Post-Processing** | Enhancements and optimizations applied to the generated code. Lives in the `src/main/resources/post-processing` directory | |
| 46 | + |
| 47 | +The generation process can be executed through the `openApiGenerate` Gradle task, which triggers the OpenAPI Generator with the specified configurations. |
| 48 | +```shell |
| 49 | +gradle clean build |
36 | 50 |
|
37 | | -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: |
| 51 | +cd generator |
| 52 | +gradle openApiGenerate --stacktrace |
| 53 | +``` |
| 54 | +The `openApiGenerate` gradle task workflow is as follows: |
38 | 55 | 1. Locates the OpenAPI specification file through the `inputSpec` environment variable, falling back to `generator/src/main/resources/specs.yaml` if not found. |
39 | 56 | 2. Consumes the OpenAPI specification file to generates code into the `xap-sdk/src/main/kotlin` directory. |
40 | 57 | 3. Generated code overrides the code present `xap-sdk/src/main/kotlin` directory, affecting only the `operations` and `models` packages. |
|
0 commit comments