Comments (3)
Leaving Other
empty seems to work:
class Other(msgspec.Struct, tag=True):
pass
>>> msgspec.json.decode(msg, type=list[Get | Put | Other])
[Put(key='my key1', val='my val'), Get(key='my key2'), Other()]
from msgspec.
Yes it works, but it means that you need to know ahead of time the literal string of every type name you're ever going to encounter, even if you don't care about them (and would be happy to either leave them as unstructured dicts or empty structs)
(Assume that there are many additional names, not just Other)
from msgspec.
Sorry, I misunderstood!
from msgspec.
Related Issues (20)
- Incorrect decoding of 65-bit integer HOT 1
- Is there a way to stop parsing long lists of JSON objects when an object with a certain property value is found
- Allow passing custom globals to use when converting dataclasses
- Positional-only arguments
- Settings Management HOT 3
- Accept hook functions in Meta for more ergonomic support of custom data types HOT 1
- Nested tagged unions?
- Nested custom extensions HOT 1
- Plugin for PyCharm / VS Code HOT 1
- `copy.replace` support
- Wrap `UnicodeDecodeError` in `msgspec.DecodeError`?
- protobuf support
- "partially-frozen" structs?
- Segmentation fault when using msgspec.Meta HOT 2
- msgspec.Struct as dict keys and Dict[TypeVar, TypeVar] support
- Support pattern for str collection types HOT 1
- Omitting defaults does not work with array-like structs HOT 1
- Collect all ValidationErrors instead of failing fast HOT 2
- Unable to handle a self-referencing union of primitive types HOT 2
- JSON and msgpack encoding fails to skip UNSET values in array_like Struct HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgspec.