-
-
Notifications
You must be signed in to change notification settings - Fork 422
Description
Describe the bug
For types like in the reproduction, titles are ignored
To Reproduce
Example schema:
{
$schema: "https://json-schema.org/draft/2020-12/schema",
$defs: {
Foo: {
type: "object",
properties: {
array: {
title: "MyName",
type: "array",
items: {
type: "string",
},
},
object: {
title: "MyObject",
type: "object",
additionalProperties: {
type: "string",
},
},
enum: {
title: "MyEnum",
enum: ["foo", "bar"],
},
oneOf: {
title: "MyOneOf",
oneOf: [
{
type: "string",
},
{
type: "number",
},
],
},
},
},
},
}Used commandline:
[tool.datamodel-codegen]
input-file-type = "jsonschema"
output-model-type = "typing.TypedDict"
target-python-version = "3.13"
use-union-operator = true
skip-root-model = true
use-standard-collections = true
use-frozen-field = true
use-title-as-name = true
Expected behavior
I'd expect it to create type aliases like
type MyName = list[str]
type MyObject = dict[str, str]
...instead, titles are simply ignored
class Foo(TypedDict):
array: NotRequired[list[str]]
object: NotRequired[dict[str, str]]
enum: NotRequired[Literal['foo', 'bar']]
oneOf: NotRequired[str | float]Version:
- OS: [e.g. iOS]
- Python version:
- datamodel-code-generator version: [e.g. 22]
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels