Skip to content

Commit 1afbb8a

Browse files
Update readmes
1 parent e79d854 commit 1afbb8a

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

‎README.md‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,22 @@ thingsboard-java-client/
7171
├── license-header-template.txt # License header for generated files
7272
├── common/
7373
│ ├── pom.xml # Compiles against CE for IDE support
74-
│ └── src/main/java/ # Handwritten shared code (ThingsboardClient, etc.)
74+
│ ├── src/main/java/ # Handwritten shared code (ThingsboardClient, etc.)
75+
│ └── docs/ # Handwritten shared docs (tb-examples.md, etc.)
7576
├── ce/
7677
│ ├── pom.xml
7778
│ ├── spec/openapi.json # OpenAPI spec (committed)
7879
│ ├── src/main/java/ # Generated + common sources (committed)
80+
│ ├── docs/ # Generated + common docs (committed)
7981
│ └── target/generated/ # Raw generator output (gitignored)
8082
├── pe/
8183
│ └── (same structure as ce)
8284
└── paas/
8385
└── (same structure as ce)
8486
```
8587

86-
The `common/` module contains handwritten classes shared across all editions (e.g. `ThingsboardClient`).
87-
It is not a runtime dependency — `generate-client.sh` copies its sources into each edition during generation.
88+
The `common/` module contains handwritten classes and docs shared across all editions (e.g. `ThingsboardClient`, `tb-examples.md`).
89+
It is not a runtime dependency — `generate-client.sh` copies its sources and docs into each edition during generation.
8890

8991
## Client Generation
9092

@@ -93,12 +95,10 @@ The `generate-client.sh` script handles the full workflow: generate, post-proces
9395

9496
### Prerequisites
9597

96-
- Node.js / npm (for `openapi-generator-cli`)
9798
- Java 25
9899
- Maven
99100
- Perl (for post-processing)
100-
101-
The script will auto-install `openapi-generator-cli` via npm if not found.
101+
- curl (for downloading the generator JAR on first run)
102102

103103
```
104104
Usage: ./generate-client.sh [options] <edition> [base-url]
@@ -118,8 +118,8 @@ Options:
118118
### Examples
119119

120120
```bash
121-
./generate-client.sh ce # Generate CE from local spec
122-
./generate-client.sh all # Generate all editions from local specs
121+
./generate-client.sh ce # Generate CE from local spec
122+
./generate-client.sh all # Generate all editions from local specs
123123
./generate-client.sh ce http://localhost:8080 # Fetch spec from a running TB, then generate
124124
./generate-client.sh --dry-run ce # Generate to target/ only, don't touch src/
125125
./generate-client.sh --verbose ce # Full output, no log filtering
@@ -130,7 +130,7 @@ Options:
130130
1. Optionally fetches OpenAPI spec from a running ThingsBoard instance
131131
2. Runs `openapi-generator-cli` (Java native HTTP client)
132132
3. Strips auto-generated OpenAPI comment blocks from Java files
133-
4. Copies generated `src/main/java/` into the module, then copies `common/` sources on top
133+
4. Copies generated `src/main/java/` and `docs/` into the module, then copies `common/` sources and docs on top
134134
5. Applies Apache 2.0 license headers via `mvn license:format`
135135
6. Stages all changes with `git add`
136136

@@ -139,10 +139,11 @@ Options:
139139
- `<edition>/pom.xml`
140140
- `<edition>/src/test/` (tests are never touched)
141141
- `<edition>/spec/openapi.json` (only updated when `base-url` is provided)
142-
- `common/` (handwritten shared sources, copied into editions)
142+
- `common/` (handwritten shared sources and docs, copied into editions)
143143

144144
### Replaced on regeneration
145145

146146
- `<edition>/src/main/java/`
147+
- `<edition>/docs/` (with `common/docs/` overlaid on top of generated docs)
147148

148149
Output log: `generate-client.log` (overwritten on each run)

‎common/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Common Module
22

3-
This module contains handwritten classes shared across all editions (CE, PE, PaaS), such as `ThingsboardClient`.
3+
This module contains handwritten classes and docs shared across all editions (CE, PE, PaaS), such as `ThingsboardClient` and `tb-examples.md`.
44

55
## How it works
66

77
- **Not a runtime dependency.** Edition modules (`ce/`, `pe/`, `paas/`) do not depend on this module's artifact.
8-
- **Source is copied by `generate-client.sh`.** During client generation, the script copies `common/src/main/java/` into each edition's `src/main/java/`. The copied files are replaced on every regeneration — same lifecycle as the generated code.
8+
- **Source and docs are copied by `generate-client.sh`.** During client generation, the script copies `common/src/main/java/` into each edition's `src/main/java/` and `common/docs/` into each edition's `docs/`. The copied files are replaced on every regeneration — same lifecycle as the generated code.
99
- **Compiles against CE.** The `pom.xml` declares a `provided`-scope dependency on `thingsboard-ce-client` solely for IDE support (autocomplete, compilation, navigation). This works because all editions share the same package structure and base classes.
1010

1111
## Development workflow
1212

13-
1. Edit files here (e.g. `ThingsboardClient.java`) — IDE support works normally
14-
2. Run `generate-client.sh` to regenerate any edition — common sources are copied automatically
15-
3. Or copy manually: `cp -r common/src/main/java/* ce/src/main/java/`
13+
1. Edit files here (e.g. `ThingsboardClient.java`, `docs/tb-examples.md`) — IDE support works normally
14+
2. Run `generate-client.sh` to regenerate any edition — common sources and docs are copied automatically
15+
3. Or copy manually: `cp -r common/src/main/java/* ce/src/main/java/` and `cp -r common/docs/* ce/docs/`

‎generate-client.sh‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
# 1. Optionally fetches OpenAPI spec from a running ThingsBoard instance
4444
# 2. Runs openapi-generator-cli (Java native HTTP client)
4545
# 3. Strips auto-generated OpenAPI comment blocks from Java files
46-
# 4. Copies generated src/main/java/ into the module (replaces previous)
46+
# 4. Copies generated src/main/java/ and docs/ into the module (replaces previous)
47+
# 4b. Copies common/src/main/java/ and common/docs/ on top
4748
# 5. Applies Apache 2.0 license headers via mvn license:format
4849
# 6. Stages all changes with git add
4950
#
@@ -54,7 +55,7 @@
5455
#
5556
# Replaced on regeneration:
5657
# - <edition>/src/main/java/
57-
# - <edition>/docs/
58+
# - <edition>/docs/ (with common/docs/ overlaid on top)
5859
#
5960
# Output log: generate-client.log (overwritten on each run)
6061
#

0 commit comments

Comments
 (0)