openapiv3 icon indicating copy to clipboard operation
openapiv3 copied to clipboard

Derive `Hash` for all types

Open benluelo opened this issue 1 year ago • 3 comments

Would be very handy to allow for them to be stored as keys in Hash{Map,Set}s.

benluelo avatar Sep 25 '23 02:09 benluelo

In addition to Hash I think you'd need Eq which can't be derived in particular because NumberType contains f64s that don't implement Eq. I'm planning on closing this in the next few days, but even if you get back here and it's closed I would invite comments or suggestions to satisfy your use case. If you don't get a response, feel free to open a new issue and my apologies if it seems like this was closed prematurely!

ahl avatar Oct 20 '23 16:10 ahl

you could use something like https://docs.rs/ordered-float/latest/ordered_float/ for NumberType, i don't think NaN is valid in an openapi spec anyways(?)

benluelo avatar Oct 20 '23 18:10 benluelo

I think that equality issues aren't limited to NaNs

ahl avatar Oct 20 '23 21:10 ahl