ciscoheat
ciscoheat
Explore posts from servers
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
Whohoo, worked directly!
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
Nice, thank you very much 🙂
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
Yes, but what you say is interesting as well. I don't know if there is an in validator in ArkType, otherwise it could be the same (as a missing key is undefined), but I don't know.
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
@ssalbdivad sorry to bother you, it's just that I'd really like 2.0 to work with Superforms. 😌 But it seems like there is a ctx.failFast check missing in the above code? Since for form validation, it's essential to have all errors reported.
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
Probably yes, but all errors should be reported anyway
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
This is what the score validator looks like:
intersection39Apply(data, ctx) {
this.domain5Apply(data, ctx) // Checking if type is a number
if (ctx.hasError()) {
return // Exits here, since a previous error exists
}
this.divisor1Apply(data, ctx)
if (ctx.failFast && ctx.hasError()) {
return
}
this.min1Apply(data, ctx)
}
intersection39Apply(data, ctx) {
this.domain5Apply(data, ctx) // Checking if type is a number
if (ctx.hasError()) {
return // Exits here, since a previous error exists
}
this.divisor1Apply(data, ctx)
if (ctx.failFast && ctx.hasError()) {
return
}
this.min1Apply(data, ctx)
}
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
Seems like there is an error count in traversal.ts that gets triggered and doesn't include some errors: https://github.com/arktypeio/arktype/blob/08b151eb07f9704080cc68db7e3ab551fafca368/ark/schema/shared/traversal.ts#L107
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
And when the schema looks like this, the tags error appear:
const schema = type({
tags: "(string>=2)[]>=3",
"date?": "Date",
"nospace?": nospacePattern,
});
const schema = type({
tags: "(string>=2)[]>=3",
"date?": "Date",
"nospace?": nospacePattern,
});
nospace matches: false
tags must be at least length 3 (was 2)
date must be a Date (was undefined)
nospace matches: false
tags must be at least length 3 (was 2)
date must be a Date (was undefined)
16 replies
Aarktype
Created by ciscoheat on 5/11/2024 in #questions
Problem with validation in 2.0 dev?
If I remove some fields from the schema:
const schema = type({
name: "string",
tags: "(string>=2)[]>=3",
score: "integer>=0",
"date?": "Date",
"nospace?": nospacePattern,
});
const schema = type({
name: "string",
tags: "(string>=2)[]>=3",
score: "integer>=0",
"date?": "Date",
"nospace?": nospacePattern,
});
The score error appears:
nospace matches: false
score must be at least 0 (was -1)
date must be a Date (was undefined)
nospace matches: false
score must be at least 0 (was -1)
date must be a Date (was undefined)
16 replies
DTDrizzle Team
Created by ciscoheat on 4/16/2024 in #help
Using parameter in LIKE
Nice, thank you
3 replies
Aarktype
Created by ciscoheat on 12/23/2023 in #questions
Array error message
Yes, I'll do that
3 replies