-
Notifications
You must be signed in to change notification settings - Fork 44
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
Overriding Schema
instantiation.
#34
Comments
Is one of the purposes of this issue / feature request to provide type hinting in VSCode and PyCharm? from datetime import date
import typesystem
class Artist(typesystem.Schema):
name = typesystem.String(max_length=100) # type: str
class Album(typesystem.Schema):
title = typesystem.String(max_length=100) # type: str
release_date = typesystem.Date() # type: date
artist = typesystem.Reference(Artist) # type: Artist
album = Album.validate({
"title": "Double Negative",
"release_date": "2018-09-14",
"artist": {"name": "Low"}
})
album.artist.name # the expected resultant type of name is str but the inspector shows Field unless I add the # type as above. Is your issue about making I am interested because this lack of correct type being provided by the inspector is a deal breaker for my team. The NOTE: pydantic, although not nearly as elegant and simple to use as typesystem in my opinion, provides the expected field type to the inspector by using the plain type. Perhaps that project should be mentioned in the Alternatives section of README.md. Thanks! |
Not specficially, but I guess that's a bit related. I'm just not convinced by my earlier design decision to have the schemas be instances themselves. I think it'd likely be neater if they were just that classes that provided the Btw. Very welcome to add pydantic to the relevant README section if you'd like, yup. |
Also mentioned in encode#34.
Eg:
The text was updated successfully, but these errors were encountered: