-
Notifications
You must be signed in to change notification settings - Fork 9
Add support for json schema string with format metadata #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use uri?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can make this private
"uuid" uuid? | ||
"binary" string? | ||
"byte" string? | ||
"date" string? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
date
and date-time
can use inst?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this needs a transform date-time fn too when #11 comes in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have #11 merged now, can use the date schemas from that.
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.