Skip to content

Commit a1bc17f

Browse files
Add duplicate operation ids validation
1 parent 73ddffc commit a1bc17f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

generate-client.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ generate() {
142142
exit 1
143143
}
144144

145+
# Detect duplicate operationIds (ThingsBoard's spec generator appends _1, _2, etc.)
146+
local duplicates
147+
duplicates=$(grep -o '"operationId" *: *"[^"]*"' "$spec_file" | sed 's/.*: *"//;s/"//' | grep -E '_[0-9]+$' || true)
148+
if [ -n "$duplicates" ]; then
149+
echo "Error: spec contains duplicate operationIds (suffixed by ThingsBoard):"
150+
echo "$duplicates" | sed 's/^/ /'
151+
echo "Fix the @ApiOperation annotations in ThingsBoard source to use unique names."
152+
exit 1
153+
fi
154+
145155
# Run 1 — Java client (single class, no docs)
146156
echo "Generating client for edition: $edition from $spec_file"
147157
openapi-generator-cli generate \

0 commit comments

Comments
 (0)