Closed AnalyzeNCode closed 3 years ago
Hi Subhash!
Thank you for reaching out. Sorry for the trouble. It appears you're missing the operators import to support the usage of <+>
. If you add open Validus.Operators
to your imports, it should work!
Oh, it's silly mistake by me. I have open the operators and the error has resolved. @pimbrouwers Thanks for the quick response.
@pimbrouwers The IDE (VS Code with Ionide) showing error as mentioned below in screenshot but the program execute successfully.
Actually, I tried by reloading window and also by restarting the vscode but still the IDE level error is there.
It's not like an issue in validus but just wanted to point out.
Edited: By adding None after pattern string resolves the IDE error but it generates error at compile time. For ex. If the code is like, let emailValidator = Validators.Default.String.betweenLen 8 512 <+> Validators.Default.String.pattern "@" None
Then there is no error in IDE, but when compile, I am getting following error.
ValidusInbuiltValidators.fs(10,13): error FS0001: Type mismatch. Expecting a 'Validator
No problem at all my friend! That is very interesting. I will try and repro this in the afternoon when I have some free time.
Appreciate you troubleshooting with me!
Just tested this out in VS Code and it worked for me:
In looking at your screenshots again, I see the problem. Your file extension is .fs
but should be .fsx
.
I execute code by selecting and then Alt+Enter. I don't know the difference between both approach. Like, code in .fs file and code in .fsx. But I will try the in .fsx as well.
My most of experience is in C# and have just recently start programming in F# so don't have much idea about these concepts.
I have checked in .fsx and it's working. Thanks.
I was just trying the sample of custom validator from the document but getting following compile time error. Am I missing anything?