Clojure

[spec] Error attempting to unform unconformed keys (no :conform-keys opt)

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.9
  • Fix Version/s: Release 1.10
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Vetted

Description

Minimal failing case:

(s/def ::key-spec (s/or :kw keyword? :str string?))
(s/def ::map-spec (s/map-of ::key-spec identity))
(println (s/unform ::map-spec (s/conform ::map-spec {:a :b})))
java.lang.UnsupportedOperationException: nth not supported on this type: Keyword

If keys are not conformed, we should also not attempt to unform them.

  1. clj-2199.patch
    12/Aug/17 4:23 AM
    6 kB
    Daniel Stockton
  2. clj-2199.patch
    08/Aug/17 8:29 AM
    3 kB
    Daniel Stockton

Activity

Hide
Daniel Stockton added a comment -

Add test and fix behaviour

Show
Daniel Stockton added a comment - Add test and fix behaviour
Hide
Daniel Stockton added a comment - - edited

Actually, although this passes all tests, it's not alright because it bypasses validation.

Show
Daniel Stockton added a comment - - edited Actually, although this passes all tests, it's not alright because it bypasses validation.
Hide
Daniel Stockton added a comment -

I think it passes for correctness this time but open to advice if this is not a good approach.

Show
Daniel Stockton added a comment - I think it passes for correctness this time but open to advice if this is not a good approach.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: