Describe the bug
Renderer cannot represent numbers written in scientific notation.
To Reproduce
Use a validator using decimal.Decimal with a least 7 decimals. Starting at 7 decimals, numbers will get printed in scientific notation (eg. 1E-7)
class MyTestModel(models.Model):
value= models.DecimalField(
max_digits=9
decimal_places=7,
validators=[MinValueValidator(Decimal("0.0000001")), MaxValueValidator(Decimal("1.0"))],
)
The resulting YAML will look like !!int '1E-7' and an error will be generated in Redoc view cannot resolve a node with !<tag:yaml.org,2002:int> explicit tag
Expected behavior
The value should be 0.0000001 in the yaml file.
It looks like the issue comes from the following method where the str method is used. Maybe a format would work value = '{:f}'.format(data)
Thank you in advance
Describe the bug
Renderer cannot represent numbers written in scientific notation.
To Reproduce
Use a validator using decimal.Decimal with a least 7 decimals. Starting at 7 decimals, numbers will get printed in scientific notation (eg. 1E-7)
The resulting YAML will look like
!!int '1E-7'and an error will be generated in Redoc viewcannot resolve a node with !<tag:yaml.org,2002:int> explicit tagExpected behavior
The value should be
0.0000001in the yaml file.It looks like the issue comes from the following method where the
strmethod is used. Maybe a format would workvalue = '{:f}'.format(data)Thank you in advance