-
Notifications
You must be signed in to change notification settings - Fork 984
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
Introduce malli library #17867
Merged
Merged
Introduce malli library #17867
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a4ef4c1
Set up Malli
ilmotta 4e7c2f2
Run nix-update-clojure
ilmotta fbc366f
Use custom reporter to warn developer of schema errors
ilmotta da101a2
Always transform to schema instances
ilmotta 58378f8
Automatically remove visible schema errors if function is called corr…
ilmotta 15418a8
Improve namespace structure in src/schema/
ilmotta a4de610
Fix docstring typo
ilmotta 1acfafe
Let function instrumentation be a nop when an error happens
ilmotta 7bdc401
Initialize the app anyway if there are invalid schemas
ilmotta a871e18
Remove unused macro
ilmotta e060e09
Remove unnecessary zprint setting
ilmotta 11e931b
Move schema definition to the bottom of the file
ilmotta 3908cad
Get rid of macro wrapper
ilmotta b83b222
Extract styles to style namespace
ilmotta b6e5f0f
Use bottom inset (esp. important for iOS)
ilmotta 24be3c1
Rename function and remove unnecessary docstring
ilmotta c9b62c7
Remove def from refer-clojure
ilmotta 6887e4b
feat: malli error component extra styling/info
clauxx d007baf
Remove unnecessary docstring
ilmotta 71bb2de
Allow vars to be instrumented with exception checks
ilmotta f2b3c4d
Short circuit unit tests and print errors correctly
ilmotta 61e6fd0
Refactor: extract function
ilmotta a782965
Schema README updates
ilmotta 9e351e5
Fix failed test (detected by instrumentation)
ilmotta c974afc
Move schema before function definition
ilmotta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{:lint-as {malli.experimental/defn schema.core/defn} | ||
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,10 +2,24 @@ | |
(:require | ||
[quo.components.counter.step.style :as style] | ||
[quo.components.markdown.text :as text] | ||
[quo.theme :as theme] | ||
quo.theme | ||
[react-native.core :as rn] | ||
[schema.core :as schema] | ||
[utils.number])) | ||
|
||
(def ?schema | ||
[:=> | ||
[:catn | ||
[:props | ||
[:map {:closed true} | ||
[:accessibility-label {:optional true} [:maybe :keyword]] | ||
[:customization-color {:optional true} [:maybe :schema.common/customization-color]] | ||
[:in-blur-view? {:optional true} [:maybe :boolean]] | ||
[:theme :schema.common/theme] | ||
[:type {:optional true} [:enum :active :complete :neutral]]]] | ||
[:value [:maybe [:or :string :int]]]] | ||
:any]) | ||
|
||
(defn- view-internal | ||
[{:keys [type accessibility-label theme in-blur-view? customization-color]} value] | ||
(let [type (or type :neutral) | ||
|
@@ -23,6 +37,9 @@ | |
[text/text | ||
{:weight :medium | ||
:size :label | ||
:style {:color (style/text-color type theme)}} label]])) | ||
:style {:color (style/text-color type theme)}} | ||
label]])) | ||
|
||
(def view (theme/with-theme view-internal)) | ||
(def view | ||
(quo.theme/with-theme | ||
(schema/instrument #'view-internal ?schema))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI: This is the functional approach with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: I added these aliases because there's a tendency devs would copy from tutorials alias abbreviations like
mu
to meanmalli.util
, orme
to meanmalli.error
.