# |
Nov 27th 2017, 22:16 |
inoas |
because it integrates with formhelper so well |
# |
Nov 27th 2017, 22:16 |
inoas |
I will try this first before using json validator however |
# |
Nov 27th 2017, 22:16 |
inoas |
the thing is I am not sure how to do nested validation and everything |
# |
Nov 27th 2017, 22:16 |
inoas |
https://book.cakephp.org/3.0/en/core-libraries/form.html |
# |
Nov 27th 2017, 22:15 |
inoas |
but it is called modelless forms |
# |
Nov 27th 2017, 22:15 |
inoas |
it should be called form validator |
# |
Nov 27th 2017, 22:15 |
inoas |
well because I don't have database models |
# |
Nov 27th 2017, 22:11 |
saeideng |
why Modelless? |
# |
Nov 27th 2017, 22:10 |
inoas |
I will see if I will validate say with Modelless Forms (CakePHP3) or Json Validator |
# |
Nov 27th 2017, 22:05 |
saeideng |
:clap: |
# |
Nov 27th 2017, 21:58 |
inoas |
https://gist.github.com/inoas/f1f87766060d85c89368afd953c91375#file-json-php-L74-L88 |
# |
Nov 27th 2017, 21:57 |
inoas |
Options::validate($options); (internally using json encode, throwing exceptions obviously) |
# |
Nov 27th 2017, 21:57 |
inoas |
well json would only be used to validate |
# |
Nov 27th 2017, 21:56 |
saeideng |
but I wonder about fetching/searching |
# |
Nov 27th 2017, 21:55 |
saeideng |
looks good and I used in some app (json instead of plain type) |
# |
Nov 27th 2017, 21:54 |
saeideng |
I bookmarked these pages :thinking_face: |
# |
Nov 27th 2017, 21:54 |
inoas |
everywhere where we do array syntax access basically |
# |
Nov 27th 2017, 21:53 |
inoas |
we got those $options everywhere and we should add validators to those imho instead of checking for keys manually |
# |
Nov 27th 2017, 21:53 |
inoas |
and it is ultra verbose to use |
# |
Nov 27th 2017, 21:53 |
inoas |
complex data objects are important though and setting up a whole javaish class chain takes days |
# |
Nov 27th 2017, 21:53 |
inoas |
but I am using json validator to do it |
# |
Nov 27th 2017, 21:52 |
inoas |
you can only do it with complex database models really |
# |
Nov 27th 2017, 21:52 |
inoas |
yes it is no fun to do so |
# |
Nov 27th 2017, 21:52 |
saeideng |
in cake you no able to validate deep data |
# |
Nov 27th 2017, 21:52 |
inoas |
I am moving many things from dbms to json because everything can then go through git flow |
# |
Nov 27th 2017, 21:51 |
inoas |
https://spacetelescope.github.io/understanding-json-schema/ |
# |
Nov 27th 2017, 21:51 |
inoas |
this one is great |
# |
Nov 27th 2017, 21:51 |
inoas |
that's just an example on how to do it |
# |
Nov 27th 2017, 21:50 |
inoas |
that shine |
# |
Nov 27th 2017, 21:50 |
saeideng |
thank you |
# |
Nov 27th 2017, 21:50 |
inoas |
and there is 3rd party docs |
# |
Nov 27th 2017, 21:50 |
inoas |
the documentation is excellent too |
# |
Nov 27th 2017, 21:50 |
saeideng |
:slightly_smiling_face: |
# |
Nov 27th 2017, 21:50 |
inoas |
I am going to remove it again ;) |
# |
Nov 27th 2017, 21:49 |
inoas |
I really like json schema because it is simple and understandable https://gist.github.com/inoas/58ef2ec9c81e0436332d5ea26a6124c0 |
# |
Nov 27th 2017, 21:49 |
inoas |
I don't know jsontype just dug it up on npmjs.com |
# |
Nov 27th 2017, 21:49 |
saeideng |
but i have a bit problem with jsontype |
# |
Nov 27th 2017, 21:49 |
inoas |
I mean we could convert $options to json just to validate them |
# |
Nov 27th 2017, 21:48 |
inoas |
huh :)? |
# |
Nov 27th 2017, 21:48 |
saeideng |
I say about cake jaon type :slightly_smiling_face: |
# |
Nov 27th 2017, 21:48 |
inoas |
http://json-schema.org/ |