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

add support for union with metadata #166 #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AnkurDedania
Copy link

@AnkurDedania AnkurDedania commented Jan 19, 2023

An approach to fix issues described in #166 where metadata configuration needs to be passed

@dairiki
Copy link
Collaborator

dairiki commented Jan 20, 2023

Thank you for the PR.

I’m not convinced that this is the correct solution to the issue.
When constructing a schema for:

@dataclass
class X
    y: Union[SomeType, OtherType] = field(metadata=some_metadata)

we need to construct three schema fields: one for SomeType, one for OtherType, and finally one for the Union. In the general case, it seems unreasonable to assume that we want to pass exactly the same custom metadata to all three of those fields.

I've just left a comment on #166 with more on this.

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 this pull request may close these issues.

2 participants