mmontone / clavier Goto Github PK
View Code? Open in Web Editor NEW:heavy_check_mark: General purpose validation library for Common Lisp
License: MIT License
:heavy_check_mark: General purpose validation library for Common Lisp
License: MIT License
I want to use validator like this
(let ((validator (make-instance 'boolean-validator :error-p t)))
(funcall validator "hi"))
=> #<VALIDATION-ERROR hi: hi is not a boolean {1003B01EF3}>
What do you say to this option?
Say we have a form field that can be empty, but when non empty it should be validated. Can we express that?
I tried with a ||
and non-blank
or blank
but it isn't the right logic.
Is this expected to be done on this layer?
I can add this meaning on my side, but this looks like it should be done inside the validation library.
(defun my-validators ()
(dict 'isbn (list :allow-blank
(clavier:not-blank)
(clavier:len :min 10 :max 13))
…))
…
(loop for validator in (validators)
if (and (eql :allow-blank validator)
(str:blankp val))
return t
else
do (unless (keywordp validator)
(multiple-value-bind (success msg)
(clavier:validate validator val)
…
Best,
I tried to create a new validator class, but this won't compile:
Cannot CHANGE-CLASS objects into CLASS metaobjects.
(defclass allow-blank-validator (validator)
()
(:metaclass closer-mop:funcallable-standard-class))
Hello,
it seems that :min-message
and :max-message
are not displayed. Also why not have a :message
?
(defun len (&key min max message min-message max-message)
(make-instance 'length-validator
:min min
:max max
:message message <---- adding message but this creates an error on validation.
:min-message min-message
:max-message max-message))
(will send PR later if I confirm the needs)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.