Whole file
keleshev/schema
The author described this change as “Handle wrong keys better. Fixes #3 and #15”. It counts as a record because the check below fails on the code as it stood at a07cafd27 and passes on 2af1f4e08, with nothing else changed between the two runs.
Projectkeleshev/schema
Fix saved2014-02-03
Sharing licenceMIT · LICENSE-MIT
Change size+1 −3
What the code was meant to do, written into the code itself as a save note
Handle wrong keys better. Fixes #3 and #15
The change
| 134 | 134 | new[nkey] = nvalue | |
| 135 | 135 | elif skey is not None: | |
| 136 | 136 | if x is not None: | |
| 137 | - | raise SchemaError(['key %r is required' % key] + | |
| 137 | + | raise SchemaError(['invalid value for key %r' % key] + | |
| 138 | 138 | x.autos, [e] + x.errors) | |
| 139 | - | else: | |
| 140 | - | raise SchemaError('key %r is required' % skey, e) | |
| 141 | 139 | coverage = set(k for k in coverage if type(k) is not Optional) | |
| 142 | 140 | required = set(k for k in s if type(k) is not Optional) | |
| 143 | 141 | if coverage != required: |
The check that tells the two apart
fail→pass·test_schema.py::test_dict
Check file test_schema.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before ita07cafd27fd84cd0a007ce0960f39508c866a011
Broken version dated2014-02-03
Moduleschema
Units changedSchema
Fingerprint6506612b53a82d21
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in keleshev/schema
- 2026-06-15Fix custom error on a key schema being lost for wrong keys
- 2026-06-13Fix TypeError when building the key error message for a tuple key
- 2025-02-27fix: JSON Schema missing title in subschemas
- 2017-01-17fix: Schema can be inherited (#127)
- 2016-02-16add strict flag in Schema class to skip wrong key validation without wildcard
- 2015-09-26Fix reliance on `__name__` of callables