You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A backend server for OneLiteFeather's Vulpes project, providing a REST API and database access.
4
+
5
+
## Features
6
+
7
+
- REST API for managing custom attributes, fonts, items, and notifications
8
+
- OpenAPI documentation
9
+
- Automatic Dart Dio client generation
10
+
11
+
## OpenAPI and Dart Client Generation
12
+
13
+
This project automatically generates a Dart Dio client from the OpenAPI specification during the build process. The client is then pushed to a separate Git repository with the project version as a tag.
14
+
15
+
### How it works
16
+
17
+
1. The OpenAPI specification is generated during the build process using Micronaut's OpenAPI support.
18
+
2. The OpenAPI Generator Gradle plugin is used to generate a Dart Dio client from the specification.
19
+
3. The generated client is pushed to the [vulpes-client](https://github.com/OneLiteFeatherNET/vulpes-client) repository with the project version as a tag.
20
+
21
+
### Configuration
22
+
23
+
The OpenAPI Generator is configured in the `build.gradle.kts` file:
"pubHomepage" to "https://github.com/OneLiteFeatherNET/vulpes-client",
40
+
"pubRepository" to "https://github.com/OneLiteFeatherNET/vulpes-client",
41
+
"dateLibrary" to "core",
42
+
"enumUnknownDefaultCase" to "true"
43
+
))
44
+
}
45
+
```
46
+
47
+
### GitHub Actions
48
+
49
+
The GitHub Actions workflow is configured to run the client generation and repository pushing during the release process. The workflow uses a custom secret called `CLIENT_REPO_TOKEN` for authenticating with GitHub when pushing to the client repository.
50
+
51
+
To set up the `CLIENT_REPO_TOKEN`:
52
+
53
+
1. Create a personal access token with the `repo` scope.
54
+
2. Add the token as a secret in the repository settings with the name `CLIENT_REPO_TOKEN`.
55
+
56
+
## Development
57
+
58
+
### Prerequisites
59
+
60
+
- Java 21
61
+
- Gradle
62
+
- Node.js (for semantic-release)
63
+
64
+
### Building
65
+
66
+
```bash
67
+
./gradlew build
68
+
```
69
+
70
+
### Running
71
+
72
+
```bash
73
+
./gradlew run
74
+
```
75
+
76
+
### Testing
77
+
78
+
```bash
79
+
./gradlew test
80
+
```
81
+
82
+
## License
83
+
84
+
This project is licensed under the AGPL-3.0 License - see the LICENSE file for details.
Copy file name to clipboardExpand all lines: build.gradle.kts
+84Lines changed: 84 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@ plugins {
3
3
alias(libs.plugins.micronaut.aot)
4
4
jacoco
5
5
`maven-publish`
6
+
id("org.openapi.generator") version "7.14.0"
6
7
}
7
8
8
9
java {
@@ -91,6 +92,89 @@ tasks {
91
92
csv.required.set(false)
92
93
}
93
94
}
95
+
this.openApiGenerate {
96
+
dependsOn("compileJava")
97
+
}
98
+
register("pushDartClient") {
99
+
dependsOn("openApiGenerate")
100
+
doLast {
101
+
val clientDir = file("$buildDir/generated/dart-client")
102
+
val version = project.version asString
103
+
104
+
// Get GitHub credentials from environment variables
105
+
val githubToken =System.getenv("CLIENT_REPO_TOKEN") ?:System.getenv("GITHUB_TOKEN") ?:throwGradleException("CLIENT_REPO_TOKEN or GITHUB_TOKEN environment variable is required")
106
+
107
+
// Create a temporary directory for the Git repository
108
+
val tempDir = file("$buildDir/temp/vulpes-client")
0 commit comments