mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
📚 Clarify JSON schema key decoding
Distinguish the custom map key decoder from Malli's encoders and point to the string-key roundtrip test. AI-assisted-by: gpt-6.1-terra
This commit is contained in:
parent
0758897e07
commit
71cd3c5bd5
@ -1,5 +1,5 @@
|
||||
# Common schema and coercion
|
||||
|
||||
- Start at `app.common.schema`. Its `json-transformer` supports key decoding and encoding for map-of schemas as well as value transformation. `coercer` decodes JSON-shaped input with that transformer and validates the result.
|
||||
- Start at `app.common.schema`. Its `json-transformer` adds custom `:map-of` key decoding based on the key schema and uses Malli's JSON encoders; it does not define a matching custom key encoder. For a string-key JSON roundtrip see `map-of-with-strings` in `common/test/common_tests/types/shape_decode_encode_test.cljc`. `coercer` decodes JSON-shaped input with that transformer and validates the result.
|
||||
- `check-fn` returns a reusable validator that raises `ex-info` with default `:type :assertion`, `:code :data-validation` and `::explain`. Prefer a reusable checker in repeated or hot paths; `sm/check` creates one on each call.
|
||||
- `check-fn` resolves its schema through `app.common.data.macros/lazy-delay`: an invalid schema can fail on namespace load in development and JVM tests, but on first use in production CLJS. See the macro docstring and target closure defines.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user