DecimalField represented as type string with minimum and maximum #335
Labels
bug
Something isn't working
fix confirmation pending
issue has been fixed and confirmation from issue reporter is pending
Describe the bug
DecimalField
fields that usemax_digits
ordecimal_places
are represented in the schema as a typestring
withminimum
andmaximum
properties, but according to the specs (or what I understand of them) is thatminimum
andmaximum
properties only apply to fields of typenumber
.This is giving me issues in the validation library I'm using (drf-openapi-tester) because it expects that fields with
minimum
andmaximum
properties to be numbers. After checking the specs IMHO the problem is in the schema (even if the validation library could be a bit more flexible and not fail on this).To Reproduce
E.g.: for this field:
This is generated in the schema:
Expected behavior
Maybe instead of specifying minimum and maximum values, specify a string pattern? Something like
^\d{1,7}(?:\.\d{1,3})?$
ifmax_digits
is 7 anddecimal_places
is 3.The text was updated successfully, but these errors were encountered: