Add support for json schema string with format metadata#13
Conversation
Both StringSchema and JsonSchema (with "string" type) use a new transform-string helper. This enables structured handling of formats like uuid, date, and email, while preserving support for maxLength, pattern, and enumerations.
| "date-time" string? | ||
| "password" string? | ||
| "email" string? | ||
| "uri" string? |
There was a problem hiding this comment.
This could use uri?
There was a problem hiding this comment.
can we test it a bit in a reitit server to see what type the coercion produces?
| (case fmt | ||
| "uuid" uuid? | ||
| "binary" string? | ||
| "byte" string? |
There was a problem hiding this comment.
same for this, test coercion in the server
|
thanks for this, will have a look later today or by tomorrow! |
|
@john-shaffer can i ask a favour of you to maybe test these changes with the 3.1.0 samples you have too? this would greatly help me out. @JohanCodinha can we also add the yamls to the repo too? we should run the full parse test i feel. |
|
Have a look here, let me know if you like that way of testing I can add it here too. |
|
@JohanCodinha yes, lets get some of the yamls in here too like that. |
| "ipv6" string? | ||
| string?)) | ||
|
|
||
| (defn transform-string |
| "uuid" uuid? | ||
| "binary" string? | ||
| "byte" string? | ||
| "date" string? |
Sure. I tested the changes in my app with good results. Not only does this patch work well, it pinpointed a bug in my app. |
|
That's awesome to hear @john-shaffer |
|
Regarding date and date-time formats, my app handles this by parsing the strings that come in from reitit. AFAIK all |
|
right, so with this change if we use |
|
Thanks, I'm not very familiar with malli coercion. I tested with |
|
@JohanCodinha i think if you could add in the tests, I can follow up with the rest of the changes myself 😄 |
No description provided.