Skip to content

Commit 38de0ea

Browse files
committed
initial version
1 parent a7ec6a6 commit 38de0ea

File tree

19 files changed

+2362
-1
lines changed

19 files changed

+2362
-1
lines changed

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 25
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '25'
21+
distribution: 'temurin'
22+
cache: gradle
23+
24+
- name: Grant execute permission for gradlew
25+
run: chmod +x gradlew
26+
27+
- name: Build with Gradle
28+
run: ./gradlew build
29+
30+
- name: Upload build artifacts
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: jar
34+
path: build/libs/*.jar
35+
36+
publish:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
if: startsWith(github.ref, 'refs/tags/v')
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up JDK 25
45+
uses: actions/setup-java@v4
46+
with:
47+
java-version: '25'
48+
distribution: 'temurin'
49+
cache: gradle
50+
51+
- name: Grant execute permission for gradlew
52+
run: chmod +x gradlew
53+
54+
- name: Publish to GitHub Packages
55+
run: ./gradlew publish
56+
env:
57+
GITHUB_ACTOR: ${{ github.actor }}
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Create GitHub Release
61+
uses: softprops/action-gh-release@v1
62+
with:
63+
files: build/libs/*.jar
64+
generate_release_notes: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@
2222
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
2323
hs_err_pid*
2424
replay_pid*
25+
.DS_Store
26+
/.gradle
27+
/.idea
28+
/build

AGENTS.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- `src/main/java/de/tum/cit/aet/openapi/` contains the generator implementation (entry point: `Angular21Generator.java`).
5+
- `src/main/resources/angular21/` holds Mustache templates used for generated Angular output (`model.mustache`, `api-service.mustache`, `api-resource.mustache`, etc.).
6+
- `src/main/resources/META-INF/services/` registers the generator for the OpenAPI SPI.
7+
- `example/` includes a sample OpenAPI spec (`example/example-openapi.yaml`) for manual checks.
8+
- `build/` is Gradle output (ignore for source edits).
9+
10+
## Build, Test, and Development Commands
11+
- `./gradlew build` — compiles, runs tests, and produces JARs.
12+
- `./gradlew test` — runs JUnit tests (if present).
13+
- `./gradlew publishToMavenLocal` — publishes the generator to your local Maven repo for quick integration testing.
14+
- `./gradlew publish` — publishes to GitHub Packages (requires `GITHUB_ACTOR`/`GITHUB_TOKEN`).
15+
16+
## Coding Style & Naming Conventions
17+
- Java 25 source; follow standard Java style (4-space indentation, braces on the same line).
18+
- Keep generator options as `UPPER_SNAKE_CASE` constants in `Angular21Generator.java`.
19+
- Template outputs follow naming patterns defined in the generator: models use `.ts`, APIs use `*-api.ts`, resources use `*-resources.ts`.
20+
- Mustache templates should stay minimal; prefer code in Java when logic is complex.
21+
22+
## Testing Guidelines
23+
- JUnit Jupiter is configured in Gradle. There are currently no test sources in `src/test/java`.
24+
- If you add tests, name classes `*Test.java` and keep them under `src/test/java`.
25+
- Run `./gradlew test` before submitting changes that affect code generation.
26+
27+
## Commit & Pull Request Guidelines
28+
- The Git history currently contains only an “Initial commit,” so no formal commit convention exists yet.
29+
- Use concise, imperative commit messages (e.g., “Add template option for X”).
30+
- PRs should include a short description, the rationale, and how you validated changes (commands or manual checks). If generated output changes, mention the impacted files or templates.
31+
32+
## Architecture Overview
33+
- `Angular21Generator` extends the OpenAPI TypeScript Angular generator and swaps template mappings to the files in `src/main/resources/angular21/`.
34+
- CLI config options are wired through `processOpts()` and then exposed to templates via `additionalProperties`.
35+
- Generation outputs are routed to `generated-code/angular21/` by default and follow the naming patterns set in the generator.
36+
37+
## Configuration Tips
38+
- The generator is registered via `src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig`—update it only if the main class name changes.
39+
- Publishing to GitHub Packages requires environment credentials; avoid hardcoding tokens in Gradle.

0 commit comments

Comments
 (0)