remcohaszing / flask-openapi

Generate a `swagger.json` handler from a Flask app
MIT License
3 stars 2 forks source link

Support full Schema object #2

Open remcohaszing opened 7 years ago

remcohaszing commented 7 years ago

http://swagger.io/specification/#schemaObject

At the moment, there is an OpenAPISchemaValidator which extends Draft4Validator. This validator should be extended so it supports the full schemaObject definition.

Incoming primitive types / formats should be converted to Python types according to the schema.

Common Name type format Python type Comments
integer integer int32 int signed 32 bits
long integer int64 int signed 64 bits
float number float float
double number double decimal.Decimal
string string str
byte string byte base64 encoded characters
binary string binary any sequence of octets
boolean boolean bool
date string date datetime.date As defined by full-date - RFC3339
dateTime string date-time datetime.datetime As defined by date-time - RFC3339
password string password str Used to hint UIs the input needs to be obscured.
byte / binary

Keep as-is or decode? Keep as str or convert to bytes? Or BytesIO?

date / datetime

Convert to a timezone aware object or convert to UTC?