Skip to content

Fail to match coll-of min-count predicate #30

@avnersch

Description

@avnersch

Hi,
Thanks a lot for this library!

I have defined the following spec:

(s/def ::colors (s/coll-of string? :kind vector? :min-count 1))

And the following phrasers:

(phrase/defphraser :default
                   [_ problem]
                   problem)

(phrase/defphraser #(clojure.core/<= min-count (clojure.core/count %) max-count)
                   [_ {:keys [val]} min-count max-count]
                   (str min-count))

When running phrase-first with the following input:

(phrase/phrase-first {} ::colors [])

I expect the 2nd phraser to be matched, but actually the default phraser is matched:

{:path [],
 :pred (clojure.core/<= 1 (clojure.core/count %) Integer/MAX_VALUE),
 :val [],
 :via [:my-project.schema/colors],
 :in [],
 :phrase.alpha/mappings {:x0 1},
 :phrase.alpha/via ()}

Any ideas what am I missing?
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions