Skip to content

Commit dedb09b

Browse files
authored
Merge pull request #2948 from trycompai/main
[comp] Production Deploy
2 parents 6237c9e + 7719b9b commit dedb09b

1,261 files changed

Lines changed: 159242 additions & 2758 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
name: diagnose-generation-failure
3+
description: Use when SDK generation failed or seeing errors. Triggers on "generation failed", "speakeasy run failed", "SDK build error", "workflow failed", "Step Failed", "why did generation fail"
4+
license: Apache-2.0
5+
---
6+
7+
# diagnose-generation-failure
8+
9+
When SDK generation fails, diagnose the root cause and determine the fix strategy.
10+
11+
## When to Use
12+
13+
- `speakeasy run` failed with errors
14+
- SDK generation produced unexpected results
15+
- User says: "generation failed", "SDK build error", "why did generation fail"
16+
17+
## Inputs
18+
19+
| Input | Required | Description |
20+
|-------|----------|-------------|
21+
| OpenAPI spec | Yes | Path to spec that failed generation |
22+
| Error output | Helpful | Error messages from failed run |
23+
24+
## Outputs
25+
26+
| Output | Description |
27+
|--------|-------------|
28+
| Diagnosis | Root cause of failure |
29+
| Fix strategy | Overlay vs spec fix vs user decision |
30+
| Action items | Specific steps to resolve |
31+
32+
## Diagnosis Steps
33+
34+
1. **Run lint to get detailed errors:**
35+
```bash
36+
speakeasy lint openapi --non-interactive -s <spec-path>
37+
```
38+
39+
2. **Categorize issues:**
40+
- **Fixable with overlays:** Missing descriptions, poor operation IDs
41+
- **Requires spec fix:** Invalid schema, missing required fields
42+
- **Requires user input:** Design decisions, authentication setup
43+
44+
## Decision Framework
45+
46+
| Issue Type | Fix Strategy | Example |
47+
|------------|--------------|---------|
48+
| Missing operationId | Overlay | Use `speakeasy suggest operation-ids` |
49+
| Missing description | Overlay | Add via overlay |
50+
| Invalid $ref | **Ask user** | Broken reference needs spec fix |
51+
| Circular reference | **Ask user** | Design decision needed |
52+
| Missing security | **Ask user** | Auth design needed |
53+
54+
## What NOT to Do
55+
56+
- **Do NOT** disable lint rules to hide errors
57+
- **Do NOT** try to fix every issue one-by-one
58+
- **Do NOT** modify source spec without asking
59+
- **Do NOT** assume you can fix structural problems
60+
61+
## Troubleshooting Tree
62+
63+
```
64+
PROBLEM
65+
│
66+
├─ ResponseValidationError at runtime?
67+
│ └─ SDK types don't match server responses
68+
│ ├─ Run contract tests to identify mismatches
69+
│ └─ Fix spec or create overlay to correct types
70+
│
71+
├─ SDK doesn't match live API behavior?
72+
│ ├─ Spec may have drifted from API
73+
│ │ → Run contract tests to detect drift
74+
│ └─ Third-party spec may be inaccurate
75+
│ → Validate with contract testing before trusting
76+
│
77+
├─ Type mismatch errors in generated SDK?
78+
│ ├─ At compile time → Check spec schema definitions
79+
│ └─ At runtime → Server returns unexpected types
80+
│ → Contract testing required
81+
│
82+
└─ Enum value not recognized?
83+
└─ API returned value not in spec enum
84+
├─ Add missing value to spec/overlay
85+
└─ Or use open enums for anti-fragility
86+
```
87+
88+
## Working with Large OpenAPI Specs
89+
90+
Use `yq` (YAML) or `jq` (JSON) to inspect specs without loading full content:
91+
92+
```bash
93+
# List all paths
94+
yq '.paths | keys' spec.yaml
95+
96+
# Inspect a specific endpoint
97+
yq '.paths["/users/{id}"]' spec.yaml
98+
99+
# List all schema names
100+
yq '.components.schemas | keys' spec.yaml
101+
102+
# List all operationIds
103+
yq '[.paths[][].operationId // empty] | unique' spec.yaml
104+
```
105+
106+
## Strategy Document
107+
108+
For complex issues, produce a document:
109+
110+
```markdown
111+
## OpenAPI Spec Analysis
112+
113+
### Blocking Issues (require user input)
114+
- [List issues that need human decision]
115+
116+
### Fixable Issues (can use overlays)
117+
- [List issues with proposed overlay fixes]
118+
119+
### Recommended Approach
120+
[Your recommendation]
121+
```
122+
123+
## Related Skills
124+
125+
- `manage-openapi-overlays` - Fix issues with overlays
126+
- `setup-sdk-testing` - Contract testing for validation
127+
- `writing-openapi-specs` - Spec design best practices

0 commit comments

Comments
 (0)