add ref for number includes integer

This commit is contained in:
Dhaval Mehta 2020-01-25 19:17:07 +05:30
parent 96119603e4
commit 94af9e138c

View File

@ -218,6 +218,7 @@ class AutoSchema(ViewInspector):
elif all(isinstance(choice, int) for choice in choices): elif all(isinstance(choice, int) for choice in choices):
type = 'integer' type = 'integer'
elif all(isinstance(choice, (int, float, Decimal)) for choice in choices): # `number` includes `integer` elif all(isinstance(choice, (int, float, Decimal)) for choice in choices): # `number` includes `integer`
# SEE: https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.21
type = 'number' type = 'number'
elif all(isinstance(choice, str) for choice in choices): elif all(isinstance(choice, str) for choice in choices):
type = 'string' type = 'string'