Skip to content

List[Dict[str, str]] is not supported #63

@OpenGHz

Description

@OpenGHz

Here is the code:

`
from typing import Dict, List
from pydantic import BaseModel
from argdantic import ArgParser

class Dataset(BaseModel):
tile_size: List[Dict[int, int]] = [{"x": "1", "y": "1"}]

cli = ArgParser()

@cli.command()
def create_item(dataset: Dataset = Dataset()):
print(dataset)

if name == "main":
cli()
`

When I execute: python test.py --dataset.tile-size '{"x":"2"}' ,
an error occurred:

usage: test.py [-h] [--dataset.tile-size [JSON ...]]
test.py: error: argument --dataset.tile-size: invalid dict value: '{"x":"2"}'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions