Tin Tvrtković

Results 444 comments of Tin Tvrtković

Do you only want the class name in the JSON payload, or more information?

Interesting, ok. We're working on what we're calling tagged union support, this sounds like it. It's un/structuring a union with some metadata attached so it can be recreated on the...

We need to improve `make_dict_structure_fn` to take into account classes we're already in the process of generating (or just catch the RecursionError, but that's less efficient). #299 is just because...

That's not suprising, `MultiDict[key]` returns the first value for the key. The simplest solution is to preprocess the multidict into a normal dictionary with potential lists for values. ```python import...

Ah yeah, I see. The issue is `111` is actually a valid `list[str]` because in Python, strings are sequences of strings (characters). You could change the validation but it wouldn't...

Hi, short answer: you can override the hook for `Any` like this to get the behavior you want: ```python import typing as ty from attrs import define from cattrs import...

I see you're overriding hooks for tuples, and sure, that's a fine approach. For my approach, I tried something different: I overrode the hooks for dataclasses. Here's your example with...

Howdy! Thanks for your interest in cattrs. The good news is in the next release at least the first example will work out of the box if you use a...

You could consider the following approach: ```python from dataclasses import astuple, dataclass, fields from cattrs import Converter c = Converter() def get_converter() -> Converter: return c @dataclass class MyDataClass: a:...

Your `GenericDataClass` has no fields, I assume it should have a field of type `DataClass`? This is getting a little tricky. We can set up a separate converter with `unstruct_strat=UnstructureStrategy.AS_TUPLE`...