Skip to content

Commit fb8d44b

Browse files
committed
fix: address Copilot review feedback on OpenAPI transformer skill
- Use curl -fsSL with retry for fail-fast HTTP error handling - Pin swagger2openapi@7.0.8 with --yes for reproducible transforms - Add monitor and zoneconcierge module mappings to tag config - Add explicit fallback strategy for unmapped Babylon modules Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 71ef4f9 commit fb8d44b

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

.claude/skills/openapi-spec-transformer/SKILL.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ Download Swagger 2.0 specs from source repositories into `/tmp/`:
4444

4545
```bash
4646
# Babylon gRPC spec
47-
curl -sL -o /tmp/babylon-swagger2.yaml \
47+
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/babylon-swagger2.yaml \
4848
https://raw.githubusercontent.com/babylonlabs-io/babylon/main/client/docs/swagger-ui/swagger.yaml
4949

5050
# Staking API spec
51-
curl -sL -o /tmp/staking-swagger2.yaml \
51+
curl -fsSL --retry 3 --retry-delay 5 -o /tmp/staking-swagger2.yaml \
5252
https://raw.githubusercontent.com/babylonlabs-io/staking-api-service/main/docs/swagger.yaml
5353
```
5454

@@ -83,8 +83,8 @@ grep -c "operationId:" static/swagger/babylon-staking-api-openapi3.yaml
8383
Use `swagger2openapi` for mechanical Swagger 2.0 → OpenAPI 3.0 conversion:
8484

8585
```bash
86-
npx swagger2openapi /tmp/babylon-swagger2.yaml -o /tmp/babylon-openapi3-base.yaml
87-
npx swagger2openapi /tmp/staking-swagger2.yaml -o /tmp/staking-openapi3-base.yaml
86+
npx --yes swagger2openapi@7.0.8 /tmp/babylon-swagger2.yaml -o /tmp/babylon-openapi3-base.yaml
87+
npx --yes swagger2openapi@7.0.8 /tmp/staking-swagger2.yaml -o /tmp/staking-openapi3-base.yaml
8888
```
8989

9090
### 3b. Babylon gRPC Enhancements
@@ -158,6 +158,10 @@ tags:
158158
description: Reward calculation and distribution
159159
- name: mint
160160
description: Token inflation and minting parameters
161+
- name: monitor
162+
description: Monitor module for checkpoint and epoch verification
163+
- name: zoneconcierge
164+
description: Zone Concierge module for cross-chain header and finalization queries
161165
```
162166
163167
**5. Add x-tagGroups extension** (see references/tag-mapping.md for full structure).
@@ -173,7 +177,10 @@ tags:
173177
- `/babylon/finality/` → `finalityprovider`
174178
- `/babylon/incentive/` → `incentive`
175179
- `/babylon/mint/` → `mint`
180+
- `/babylon/monitor/` → `monitor`
181+
- `/babylon/zoneconcierge/` → `zoneconcierge`
176182
- `/cosmos/` → Keep original tag or assign `CometBFT`
183+
- Any unmapped `/babylon/<module>/` prefix → Log a warning and assign `other`
177184

178185
### 3c. Staking API Enhancements
179186

.claude/skills/openapi-spec-transformer/references/tag-mapping.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
| `/babylon/finality/` | `finalityprovider` | Finality provider registration and status |
1717
| `/babylon/incentive/` | `incentive` | Reward calculation and distribution |
1818
| `/babylon/mint/` | `mint` | Token inflation and minting parameters |
19+
| `/babylon/monitor/` | `monitor` | Monitor module for checkpoint and epoch verification |
20+
| `/babylon/zoneconcierge/` | `zoneconcierge` | Zone Concierge cross-chain header and finalization queries |
1921
| `/cosmos/` | Keep original | Standard Cosmos SDK endpoints |
2022

23+
> **Fallback**: Any unmapped `/babylon/<module>/` prefix should be logged as a warning and assigned to an `other` tag. Update this table when new modules appear in the source spec.
24+
2125
### x-tagGroups Structure
2226

2327
```yaml
@@ -77,6 +81,17 @@ x-tagGroups:
7781
- mint-params
7882
- inflation
7983
description: Mint queries
84+
- name: monitor
85+
tags:
86+
- monitor-checkpoints
87+
- monitor-epochs
88+
description: Monitor queries
89+
- name: zoneconcierge
90+
tags:
91+
- zone-chain-info
92+
- zone-headers
93+
- zone-finalization
94+
description: Zone Concierge queries
8095
```
8196
8297
---
@@ -122,13 +137,19 @@ function assignTag(path) {
122137
'/babylon/finality/': 'finalityprovider',
123138
'/babylon/incentive/': 'incentive',
124139
'/babylon/mint/': 'mint',
140+
'/babylon/monitor/': 'monitor',
141+
'/babylon/zoneconcierge/': 'zoneconcierge',
125142
};
126143
127144
for (const [prefix, tag] of Object.entries(tagMap)) {
128145
if (path.startsWith(prefix)) {
129146
return tag;
130147
}
131148
}
149+
// Log unmapped Babylon modules so they can be added to this mapping
150+
if (path.startsWith('/babylon/')) {
151+
console.warn(`Unmapped Babylon module path: ${path}`);
152+
}
132153
return 'other';
133154
}
134155
```

0 commit comments

Comments
 (0)