Fork me on GitHub
#malli
<
2020-12-27
>
euccastro02:12:20

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?

steveb8n07:12:53

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

ikitommi13:12:44

any documentation PRs most welcome

ikitommi15:12:34

thanks!

🙏 1
steveb8n04:12:41

@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

steveb8n05:12:10

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

steveb8n05:12:44

and because OSS should never be urgent 🙂

steveb8n06:12:44

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

ikitommi13:12:10

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

steveb8n01:12:51

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?

steveb8n04:12:16

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

steveb8n05:12:01

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

borkdude18:12:18

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

borkdude18:12:39

as base64? (that would seem random)

borkdude18:12:09

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

borkdude18:12:36

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

ikitommi19:12:56

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

borkdude19:12:38

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

ikitommi19:12:11

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

steveb8n23:12:47

Is this a bug? If so, I will log it…. (m/validator [:schema {:registry (merge (m/base-schemas) {:person [:multi {:dispatch :person/gender}]})} :person]) Execution error (ExceptionInfo) at malli.core/-fail! (core.cljc:79). :malli.core/child-error {:type :enum, :properties nil, :children nil, :min 1}

steveb8n23:12:50

workaround….

steveb8n23:12:00

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