|
| 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