You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tell HeyAPI that if a string has the formatlocalTime, that it should use a special transformer to set the field in the generated types:
proposal:
{
name: '@hey-api/transformers',
custom: {
type: string,
format: localTime,
parser: {
regex: "/^([01]?\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/", # For demo only
},
target: {
pathToCass: "/calendar/LocalTime", # to be used for the import
constructor: ["$1", "$2"]
}
}
},
then the parser would know how to parse the string and the transformer would know which elemento to set where in the constructor.
I just thought of that quickly... there is certainly a better API for this.
I would like to define a
transformer
for a customformat
and this should be applied when a string has this format:e.g.
then I would like to be able to parse this string into
LocalTime
.Maybe, I could create my own plugin for this?
If this doesn't fit here, I'll open a separate topic or issue.
Originally posted by @mrclrchtr in #1039 (comment)
The text was updated successfully, but these errors were encountered: