Skip to content

Commit c6d48a0

Browse files
committed
feat: implement #8 – Karavan metadata
1 parent 83fd8f7 commit c6d48a0

12 files changed

Lines changed: 2168 additions & 0 deletions

File tree

.github/pull_request_template.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## Overview
2+
3+
Provide a short summary of the change.
4+
5+
## Motivation
6+
7+
Fixes: #
8+
9+
## Changes Included ✅
10+
- [ ] Added Karavan component metadata (`rosettanet.json`)
11+
- [ ] Added generated model metadata (`src/main/resources/karavan/metadata/model/*.json`)
12+
- [ ] Added generator class (`io.dscope.tools.karavan.RosettaNetKaravanModelGenerator`)
13+
- [ ] Added Maven profile `-Pkaravan-metadata`
14+
- [ ] Added CI workflow `.github/workflows/generate-karavan-metadata.yml`
15+
- [ ] Verified local regeneration
16+
17+
## How to Test Locally 🧪
18+
```
19+
mvn -Pkaravan-metadata exec:java -Dexec.mainClass=io.dscope.tools.karavan.RosettaNetKaravanModelGenerator
20+
git diff src/main/resources/karavan
21+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Karavan Metadata Sync
2+
on:
3+
push:
4+
branches: [ main ]
5+
workflow_dispatch:
6+
7+
jobs:
8+
generate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: 21
21+
22+
- name: Build project
23+
run: mvn -q -DskipTests install
24+
25+
- name: Generate Karavan metadata
26+
run: mvn -q -Pkaravan-metadata exec:java -Dexec.mainClass=io.dscope.tools.karavan.RosettaNetKaravanModelGenerator
27+
28+
- name: Detect changes
29+
id: gitdiff
30+
run: |
31+
if [[ -n "$(git status --porcelain src/main/resources/karavan)" ]]; then
32+
echo "changed=true" >> $GITHUB_OUTPUT
33+
else
34+
echo "changed=false" >> $GITHUB_OUTPUT
35+
fi
36+
37+
- name: Commit and push metadata update
38+
if: steps.gitdiff.outputs.changed == 'true'
39+
run: |
40+
git config user.name "github-actions[bot]"
41+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
42+
git checkout -B karavan-metadata-update
43+
git add src/main/resources/karavan
44+
git commit -m "chore: regenerate Karavan metadata"
45+
git push --force --set-upstream origin karavan-metadata-update
46+
47+
- name: Open PR
48+
if: steps.gitdiff.outputs.changed == 'true'
49+
uses: peter-evans/create-pull-request@v6
50+
with:
51+
branch: karavan-metadata-update
52+
title: "chore: regenerate Karavan metadata"
53+
body: "Automated regeneration of Karavan metadata from JAXB models"
54+
labels: karavan

KARAVAN_METADATA.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Karavan Metadata Bundle
2+
3+
This bundle prepares Apache Karavan metadata for the Camel RosettaNet component.
4+
5+
## Generate all model JSONs
6+
7+
```
8+
mvn -Pkaravan-metadata -q exec:java -Dexec.mainClass=io.dscope.tools.karavan.RosettaNetKaravanModelGenerator
9+
```
10+
11+
Outputs to: `src/main/resources/karavan/metadata/model/*.json`
12+
13+
## Maven profile (add to your pom.xml)
14+
15+
```xml
16+
<profiles>
17+
<profile>
18+
<id>karavan-metadata</id>
19+
<build>
20+
<plugins>
21+
<plugin>
22+
<groupId>org.codehaus.mojo</groupId>
23+
<artifactId>exec-maven-plugin</artifactId>
24+
<version>3.3.0</version>
25+
<configuration>
26+
<classpathScope>compile</classpathScope>
27+
</configuration>
28+
</plugin>
29+
</plugins>
30+
</build>
31+
<dependencies>
32+
<dependency>
33+
<groupId>io.github.classgraph</groupId>
34+
<artifactId>classgraph</artifactId>
35+
<version>4.8.172</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>com.fasterxml.jackson.core</groupId>
39+
<artifactId>jackson-databind</artifactId>
40+
<version>2.17.1</version>
41+
</dependency>
42+
</dependencies>
43+
</profile>
44+
</profiles>
45+
```
46+
47+
## CI
48+
49+
Workflow: `.github/workflows/generate-karavan-metadata.yml`

issue.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
### Summary
2+
3+
Add Apache Karavan metadata for the RosettaNet component and all PIP JAXB models under
4+
`io.dscope.rosettanet.interchange`, so they appear in the Karavan palette with form-based editing.
5+
6+
This includes:
7+
1. Component metadata (`rosettanet.json`)
8+
2. Model metadata (`*.json`, one per `*RequestType/*ResponseType`)
9+
3. Generator tool to auto-create model metadata from JAXB classes
10+
4. GitHub Action to detect drift and auto-open PRs
11+
12+
---
13+
14+
### Why
15+
16+
- Enables visual RosettaNet editing in Karavan
17+
- No need to hand-maintain dozens of PIP structures
18+
- Metadata always stays in sync with JAXB when models update
19+
- Improves developer UX for B2B/Camel integration
20+
21+
---
22+
23+
### Acceptance Criteria ✅
24+
25+
- [ ] `src/main/resources/karavan/metadata/component/rosettanet.json` added
26+
- [ ] `src/main/resources/karavan/metadata/model/*.json` generated for all `*RequestType/*ResponseType`
27+
- [ ] `src/main/resources/karavan/metadata/model-labels.json` included (optional)
28+
- [ ] `io.dscope.tools.karavan.RosettaNetKaravanModelGenerator` committed
29+
- [ ] Maven profile `-Pkaravan-metadata` added to regenerate metadata
30+
- [ ] GitHub workflow added: `.github/workflows/generate-karavan-metadata.yml`
31+
- [ ] Workflow auto-creates PR if metadata changes
32+
33+
---
34+
35+
### Regenerate locally
36+
37+
```bash
38+
mvn -Pkaravan-metadata -q exec:java \
39+
-Dexec.mainClass=io.dscope.tools.karavan.RosettaNetKaravanModelGenerator

karavan-full-bundle.zip

5.48 KB
Binary file not shown.

0 commit comments

Comments
 (0)