Comments (2)
Yep, you're right, this isn't currently supported. I've marked this as a feature request. PRs with support are welcome!
from pydantic.
@sydney-runkle Hey, I started looking into this, and it seems a little tricky to me.
In the definition of Entity
class Entity(BaseModel):
ref: Ref[Self]
Ref
's __class_getitem__
method gets called which is defined here, though when its called, the typevar_values
parameter is just Self
, without a way to access or determine what Self
is actually referring to (none that I could tell at least).
My best idea was to perhaps look try to look up the stack to figure out what Self
refers to, kind of like what super()
does, though I'm not sure that's the best idea.
Do you perhaps have any ideas/directions into how this should be implemented?
from pydantic.
Related Issues (20)
- JsonValue is contravariant, should be covariant HOT 5
- Cannot use `str` as argument to PlainSerializer HOT 2
- Expose normalization functionality in EmailStr HOT 4
- Unable to Deserialize Model with BaseModel as Dictionary Keys HOT 1
- `isinstance` for v2 models is over 20 times slower than v1 models HOT 1
- Custom serializer discarded when WrapSerializer is used
- RootModel.model_construct() typing HOT 9
- Support more callables in `PlainSerializer`
- ComputedFieldInfo needs some love (no exclude, no default arguments)
- exclude attribute of fields is ignored in model_dump HOT 1
- Accessing a `TypedDict` field has `ValidationIterator` instead of the original value
- Type signature for Field() gt/lt/gte/lte validators should include timedelta HOT 6
- TypeAdapter docs: need example of how to dump some structure to json HOT 3
- ValidationError Input should be None when field is named as type inside Optional HOT 4
- response model with bytes field doesn't work HOT 1
- Weird Mypy error (arg-type) when using the Pydantic plugin
- Problem when serializing models with `SecretStr`s
- Json field display garbled characters when ensure_ascii=True
- Union discriminator validation raises irrelevant errors
- Pydantic generic models fail to generate schema with typing-extensions 4.12 TypeVar
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 pydantic.