Describe the bug
Bug in parsing number in scientific notation
To Reproduce
Example schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"test": {
"type": "number",
"title": "Test",
"description": "Testcase",
"default": 1e-5
}
}
}
Used commandline:
$ datamodel-codegen --input test_codegen.json --output model_test_codegen.py --output-model-type pydantic_v2.BaseModel --input-file-type jsonschema
Observed behavior
class Model(BaseModel):
test: Optional[float] = Field('1e-5', description='Testcase', title='Test')
Expected behavior
class Model(BaseModel):
test: Optional[float] = Field(1e-5, description='Testcase', title='Test')
Version:
- OS: Linux
- Python version: 3.10.12
- datamodel-code-generator version: 0.25.6
Maybe related to #1952 .
Describe the bug
Bug in parsing
numberin scientific notationTo Reproduce
Example schema:
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "test": { "type": "number", "title": "Test", "description": "Testcase", "default": 1e-5 } } }Used commandline:
Observed behavior
Expected behavior
Version:
Maybe related to #1952 .