Commit 05a727c
authored
lexlint: fix panic in breakingDefs when inner schema type changes (#1348)
## Summary
- Fix panic in `breakingDefs` when comparing lexicon definitions whose
inner schema types differ (e.g. `SchemaString` vs `SchemaObject`)
- The type-change guard compared `reflect.TypeOf` on the `SchemaDef`
wrapper structs, which are always the same type, so it never triggered —
bare type assertions like `remote.Inner.(SchemaString)` then panicked
- Fix by comparing `.Inner` field types instead
- Add regression test
## Repro
Any lexicon where a field changed type between versions (e.g. a `string`
field becoming an `object`) triggers:
```
panic: interface conversion: interface {} is lexicon.SchemaObject, not lexicon.SchemaString
goroutine 1 [running]:
github.com/bluesky-social/indigo/lex/lexlint.breakingDefs(...)
lex/lexlint/breaking.go:169
```2 files changed
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments