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

Field representation does not show generic types. #505

Closed
proofit404 opened this issue May 3, 2019 · 1 comment · Fixed by #912
Closed

Field representation does not show generic types. #505

proofit404 opened this issue May 3, 2019 · 1 comment · Fixed by #912
Labels
change Suggested alteration to pydantic, not a new feature nor a bug

Comments

@proofit404
Copy link
Contributor

proofit404 commented May 3, 2019

I tried to run this code on bff8a17

Untitled

As you can see field representation does not say List[int]

Thanks for an awesome package.

@samuelcolvin
Copy link
Member

The problem here is that field.type_ holds information and about the items in that field (eg. int here) and field.shape holds information about the "shape" of the data, eg. list, dict, set etc.

Basically field.__str__ could use some work.

https://github.com/samuelcolvin/pydantic/blob/bff8a1789dfde2c38928cced6640887b53615aa3/pydantic/fields.py#L449-L459

But I don't think this is a big urgent problem.

@samuelcolvin samuelcolvin added the bug V1 Bug related to Pydantic V1.X label May 4, 2019
@samuelcolvin samuelcolvin added change Suggested alteration to pydantic, not a new feature nor a bug and removed bug V1 Bug related to Pydantic V1.X labels Oct 17, 2019
samuelcolvin added a commit that referenced this issue Oct 18, 2019
* better str and repr for ModelField, fix #505

* better type display, fix tests

* correct _type_display signature

* fix for python3.6 differences

* fix PyObjectStr

* fix coverage
andreshndz pushed a commit to cuenca-mx/pydantic that referenced this issue Jan 17, 2020
* better str and repr for ModelField, fix pydantic#505

* better type display, fix tests

* correct _type_display signature

* fix for python3.6 differences

* fix PyObjectStr

* fix coverage
alexdrydew pushed a commit to alexdrydew/pydantic that referenced this issue Dec 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change Suggested alteration to pydantic, not a new feature nor a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants