Hi

I don't have lots of experience or knowledge with JS, so please excuse me 
if I'm misunderstanding things.
I have a simple .Net WebAPI project that just calls a few stored procs. 
Some of the parameters need to be Guids, and that is what it is defined as. 
Swagger picks up the type as string, which is fine, because the validation 
picks up the correct type and checks that the value is a valid Guid.

The problem I've come across is that, if the first character in the third 
group of the Guid is not a number, the validation fails. If I convert that 
same string in SQL to uniqueidentifier, it is valid, and if I change the 
parameter type to string, it works. My code converts it then to a Guid.

Reading the spec on Wikipedia 
<https://en.wikipedia.org/wiki/Universally_unique_identifier>seems that the 
validation is following that, the first character in the group indicates 
the version, and that is a number between and including 1 to 5, but I'm not 
sure why the Microsoft generated Guids and conversions don't follow that.

Examples:
This Guid passes the Swagger validation: f3151556-8fcb-*4*
e67-88ee-7226d8a8d9d2
This doesn't: f1c06f14-8f85-*e*611-80d6-00155d02bc0e

Both converts fine in .Net and SQL Server 2015.

The regex expression in Swagger is ^[{(]?[0-9a-f]{8}-[0-9a-f]{4}-*[1-5]*
[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}[)}]?$
Bold is where it is not matching.

Not sure what the correct route is here. Do you break the validation to not 
follow the spec, or just handle it. For now I'll handle it.

Thank you
Jaco De Bruyn

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to