Describe the bug
Items in an array are not generated as Optional, despite adding the nullable: true property.
To Reproduce
Example schema:
# test.yml
properties:
list1:
type: array
items:
type: string
nullable: true
required:
- list1
Used commandline:
$ datamodel-codegen --input test.yml --output model.py --strict-nullable
This generates a datamodel in which the list items are not nullable:
class Model(BaseModel):
list1: List[str]
Expected behavior
I would expect Optional array items to be generated:
class Model(BaseModel):
list1: List[Optional[str]]
Version:
- OS: iOS 14.2.1
- Python version: 3.8.10
- datamodel-code-generator version: 0.25.2
Describe the bug
Items in an array are not generated as
Optional, despite adding thenullable: trueproperty.To Reproduce
Example schema:
Used commandline:
This generates a datamodel in which the list items are not nullable:
Expected behavior
I would expect Optional array items to be generated:
Version: