Giter VIP home page Giter VIP logo

Comments (3)

alexanderkiel avatar alexanderkiel commented on May 25, 2024

In such situations, it's always a good idea to define a default phrase which simply returns the problem:

(defphraser :default
  [_ problem]
  problem)

with that, (phrase/phrase-first {} ::coll-of-ints [:a]) returns:

{:path [],
 :pred int?,
 :val :a,
 :via [:grape/coll-of-ints],
 :in [0],
 :phrase.alpha/mappings {},
 :phrase.alpha/via ()}

here you can see that the :pred is only int? without a namespace. Your phraser on the other hand is registered with the predicate clojure.core/int?. Thats not the same.

Here we have a spec bug. Spec should use clojure.core/int? as predicted and not simply int?. They used to use simple symbols of press everywhere in the past. I thing they just forgot to add the namespace here.

A workaround is to use a registered spec like your ::just-int in s/coll-of like so:

(s/def ::coll-of-ints (s/coll-of ::just-int))

I'll look for an existing or open an issue in the Clojure JIRA. This issue stays open until upstream is fixed.

from phrase.

alexanderkiel avatar alexanderkiel commented on May 25, 2024

The following upstream issue applies: https://dev.clojure.org/jira/browse/CLJ-2168

from phrase.

marco-m avatar marco-m commented on May 25, 2024

Thanks @alexanderkiel, I appreciate your detailed explanation!

from phrase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.