Describe the bug
When i generate my models as dataclass the generater does not consider string formats like uuid, date ... The output is just of type string which is different when i generate pydantic models.
To Reproduce
Example schema:
{
"openapi": "3.0.3",
"components": {
"schemas": {
"Input": {
"type": "object",
"additionalProperties": false,
"required": ["id"],
"properties": {
"id": {
"type": "string",
"format": "uuid"
}
}
}
}
}
}
The generated result:
from __future__ import annotations
from dataclasses import dataclass
@dataclass
class Input:
id: str
Used commandline:
$ datamodel-codegen --input ../api/openapi.json --output test.py --output-model-type dataclasses.dataclass
Expected behavior
I would expect that the id type is of type UUID like when i generate as pydantic:
from __future__ import annotations
from uuid import UUID
from pydantic import BaseModel, ConfigDict
class Input(BaseModel):
model_config = ConfigDict(
extra='forbid',
)
id: UUID
Version:
- OS: win10
- Python version: 3.11.2
- datamodel-code-generator version: 0.25.1
Describe the bug
When i generate my models as dataclass the generater does not consider string formats like uuid, date ... The output is just of type string which is different when i generate pydantic models.
To Reproduce
Example schema:
{ "openapi": "3.0.3", "components": { "schemas": { "Input": { "type": "object", "additionalProperties": false, "required": ["id"], "properties": { "id": { "type": "string", "format": "uuid" } } } } } }The generated result:
Used commandline:
Expected behavior
I would expect that the id type is of type UUID like when i generate as pydantic:
Version: