-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make spec-coerce an optional dependency #18
Conversation
Given that the cljs testsuite broke, a major bump and removing the function all-together may be the path of least resistance. |
Perhaps this would work? ;; defined in a separate .clj file
(defmacro when-spec-coerce-available [& body]
(when (try
(require 'spec-coerce.core)
true
(catch Exception _
false))
(do
~@body)))
;; no reader conditional needed
(when-spec-coerce-available
(defn coerce-map-indicating-invalidity ,,,)) Then you'd remove the |
I thought this was fixed (https://anmonteiro.com/2016/10/clojurescript-require-outside-ns/) but with little cljs experience i'm probably mistaken. Regarding the It could even be a function, I think 🤔. But this would still be a breaking change (consumers are forced to change their usage by adding a dep + require). |
It works only in the repl or similar environments, AFAIK
Some breaking changes are better than others :) one has a migration path, the other not. It seems to play well with semver + a changelog |
IMO the migration paths are similar. Adding the require + dependency to your From what I can see in the github search / grep.app there's no (public!) usage of this fn anyway. Removing it likely has very little impact whichever option we pick. |
I like using the affected fn for quick web projects |
3f52ad1
to
043c491
Compare
2bcfb9c
to
af83583
Compare
af83583
to
96ad72f
Compare
Brief
✨ Discussion piece ✨
spec-coerce isn't a common dependency for us, so i'd like to make it optional. Either by excluding the dependency in consumers (opt-out) or adding the dependency by consumers who want to use it (opt-in) or removing it altogether. In this PR i make
coerce-map-indicating-invalidity
opt-in.Alternative 1: keep
spec-coerce
inproject.clj
and exclude in consumers (made possible by the 'requiring-resolve'-call).Alternative 2: Remove function, bump major to 2.0.0
context:
components.pedestal
uses spec-coerce: https://github.com/nedap/components.pedestal/blob/c4faad869634eaeab12a82a264cf2cb0a6ed6e76/src/nedap/components/pedestal/interceptors/spec_coercer.clj#L14utils.spec.predicates
extends spec-coerse: https://github.com/nedap/utils.spec.predicates/blob/da4a1216788e50c5aa5aa894127648c0c2a42bd3/src/nedap/utils/spec/predicates.cljc#L89-L94WDYT @nedap/sts-clojure-dev ?
QA plan
Author checklist
Reviewer checklist