Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type annotations for compound fields don't address token elements #895

Closed
tefra opened this issue Dec 26, 2023 · 3 comments · Fixed by #997
Closed

Type annotations for compound fields don't address token elements #895

tefra opened this issue Dec 26, 2023 · 3 comments · Fixed by #997

Comments

@tefra
Copy link
Owner

tefra commented Dec 26, 2023

The new type annotations for compound fields can generate this

@dataclass
class Node:
    class Meta:
        name = "node"

    node_or_id: List[Union["Node", str]] = field(
        default_factory=list,
        metadata={
            "type": "Elements",
            "choices": (
                {
                    "name": "node",
                    "type": Type["Node"],
                },
                {
                    "name": "id",
                    "type": List[str],
                    "default_factory": list,
                    "tokens": True,
                },
            ),
        },
    )

It should be node_or_id: List[Union["Node", List[str]]

@tefra
Copy link
Owner Author

tefra commented Mar 9, 2024

This is fixed

@tefra
Copy link
Owner Author

tefra commented Mar 24, 2024

No it's not

@tefra tefra reopened this Mar 24, 2024
@tefra
Copy link
Owner Author

tefra commented Mar 24, 2024

Now it's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant