Commit feffc0b
Address PR review: clarify article_number docs, repr the bad GTIN, inline the migration helper
Three points from the review, all fair.
The article_number description still read 'Vendor article number, e.g. EAN, QR
code, etc.' in both the request and response schemas. That was the wording this
change exists to retire: with a dedicated gtin column, telling an API consumer to
put an EAN in article_number sends the barcode to the wrong field. Both now point
at gtin for the barcode. The client_v2 help text already said this; the OpenAPI
schema was the half that got missed.
The rejection message interpolated the raw value inside hand-written quotes, so a
scanner that appends a newline or a control character produced a mangled,
multi-line 400 body. !r keeps it on one line and escapes the value properly.
The migration imported normalize_gtin from spoolman.gtin. A migration is a
historical record -- replaying it on a fresh database has to produce what it
produced when it was written -- so it must not change when the application helper
is refactored, nor break if that module is moved. The normalization is now
inlined, with a comment saying why the duplication is deliberate. Re-verified on a
scratch SQLite database seeded with a UPC-12, EAN-13, GTIN-14, EAN-8, two
separator forms, three vendor SKUs, a malformed scan, a bad check digit, a wrong
length and a NULL: identical results to the imported version, article_number
untouched, index present, downgrade clean.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>1 parent 24cc6f7 commit feffc0b
3 files changed
Lines changed: 34 additions & 6 deletions
File tree
- migrations/versions
- spoolman/api/v1
Lines changed: 31 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | 11 | | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
19 | 47 | | |
20 | 48 | | |
21 | 49 | | |
| |||
50 | 78 | | |
51 | 79 | | |
52 | 80 | | |
53 | | - | |
| 81 | + | |
54 | 82 | | |
55 | 83 | | |
56 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
0 commit comments