malli

https://github.com/metosin/malli :malli:
euccastro 2020-12-27T02:43:20.275400Z

sorry if I missed something basic, but is there a way to specify that a string field should match a regular expression, without resorting to SCI functions?

ikitommi 2020-12-27T13:20:44.277700Z

any documentation PRs most welcome

euccastro 2020-12-27T15:23:24.278200Z

PR here: https://github.com/metosin/malli/pull/323/files

ikitommi 2020-12-27T15:41:34.278500Z

thanks!

🙏 1
steveb8n 2020-12-27T04:46:41.276500Z

@ikitommi can I trouble you for one more gist comment? this is not urgent so I’m happy to wait until your status is not “vacationing” 🙂 https://gist.github.com/stevebuik/e63735d99fca94041120f9b0e25b616d

ikitommi 2020-12-27T13:24:10.277900Z

thanks for the awesome repro, easy to dig in to this when have the extra time.

steveb8n 2020-12-28T01:24:51.287500Z

Thank you for such a big upgrade to Spec 🙂 BTW I’m also noticing some very slow perf when compiling medium complexity nested schemas. Are you interested in test cases for that as well?

steveb8n 2020-12-28T04:42:16.287800Z

The compilation slowness appears to be caused by liberal use of :merge. when I remove it and just compose maps (i.e. inline) I see compile speeds improve by 10x

steveb8n 2020-12-28T05:03:01.288Z

I’ve worked around both the compilation (i.e. validator) and runtime perf issues so this is not urgent for me. I’ll be happy to provide more test cases if you need them

steveb8n 2020-12-27T05:05:10.276600Z

not urgent because I can work around the perf by not using recursion in my initial spec replacements. full recursion will be useful but can come later

steveb8n 2020-12-27T05:05:44.276800Z

and because OSS should never be urgent 🙂

steveb8n 2020-12-27T06:23:44.277Z

I wonder if I/we could turn this into a useful sample for others to learn from? happy to do this if you agree it would be useful

steveb8n 2020-12-27T07:51:53.277200Z

have you considered using :fn without using sci? why is that not a good solution?

borkdude 2020-12-27T18:27:18.279400Z

How does malli expect bytes? to be delivered e.g. when you have a JSON api

borkdude 2020-12-27T18:27:39.279900Z

as base64? (that would seem random)

borkdude 2020-12-27T18:28:09.280500Z

or would one do a pass over the json, deserialize the base64 manually?

borkdude 2020-12-27T18:28:36.281100Z

I'm asking this since babashka pods communicate via edn or json, which doesn't have a built-in way to represent bytes. transit does have it

ikitommi 2020-12-27T19:27:56.283Z

@borkdude atm, there is no default encoding/decoding bytes and strings. Looking at OpenAPI docs, the guide is: > base64-encoded characters, for example, U3dhZ2dlciByb2Nrcw==

borkdude 2020-12-27T19:28:38.284Z

for now I went with transit. it does it for me.. I should look into how it does it

ikitommi 2020-12-27T19:29:11.285100Z

so, there could be a byte<->string transformers in malli.transform to make this a default

borkdude 2020-12-27T19:30:07.285900Z

steveb8n 2020-12-27T23:16:50.286900Z

workaround….

steveb8n 2020-12-27T23:17:00.287100Z

(m/validator [:schema
              {:registry {:person [:multi {:dispatch :person/gender}]}}
              :person])