boxdot / openapi-schema

Apache License 2.0
4 stars 1 forks source link

supports isize and usize #13

Closed antoine-de closed 5 years ago

antoine-de commented 5 years ago

and also change the schema_type from number to the more precise integer

For u|isize, it's not very clear if we can drop the format field.

It seems ok for swagger v3 doc, but the case is not listed in openapi.

I supposed it was a mistake from openapi, but we could also maybe do some clever trick with std::mem::size_of ?

boxdot commented 5 years ago

std::mem::size_of can be indeed used to determine the bytes size of usize: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=9b1f89c570ba37fc158c9d7dac6934cd

I also think that it is actually ok to assume that usize has 64 bits for APIs. In any case, thanks for the PR. I merge it, and if you want, you can create another one with usize adjustments.