Commit ec25db0
feat: add enum discriminator support and identifier validation
This addresses additional code review feedback (Priority 2 items):
1. Add single-value enum discriminator support
- Previously only handled "const" discriminators
- Now also supports "enum": ["value"] as discriminator
- Enables semantic naming for more schema patterns
2. Add identifier validation in snake_to_pascal()
- Validates result is a valid Python identifier
- Raises clear error if conversion produces invalid name
- Prevents silent failures with unicode/special characters
Why these are easy wins:
- Enum support: 3-line addition, handles edge case
- Identifier validation: 5-line addition, defensive programming
- Both improve robustness with minimal complexity
Example: If a schema has discriminator like:
"status": {"enum": ["active"]} ← now detected same as const
Addresses code review Priority 2 items from code-reviewer agent.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 2895b80 commit ec25db0
1 file changed
+19
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
33 | 46 | | |
34 | 47 | | |
35 | 48 | | |
| |||
100 | 113 | | |
101 | 114 | | |
102 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
103 | 120 | | |
104 | 121 | | |
105 | 122 | | |
| |||
0 commit comments