question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

List[T] validation is not strict enough

See original GitHub issue

with this kind of model :

class Foo(BaseModel):
    items: List[int]

Foo(items='') does not throw any error. Looking at the code, we do not check the list is a list, but we iterate over it and check the elements. Any empty iterable can be used for List[T]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mgucommented, Oct 23, 2017

For me there is a difference between typing.List and typing.Sequence '123' is a Sequence, not a List

0reactions
Gr1Ncommented, Jun 13, 2018

@samuelcolvin can we close this issue? Fix merged

Read more comments on GitHub >

github_iconTop Results From Across the Web

List[T] validation is not strict enough · Issue #86 · pydantic ...
Looking at the code, we do not check the list is a list, but we iterate over it and check the elements. ......
Read more >
C5: Validate All Inputs - OWASP Top 10 Proactive Controls 2018
Blacklisting or blacklist validation attempts to check that given data does not contain “known bad” content. For example, a web application may block...
Read more >
HTML Strict validation is not recognizing my imported ...
I am just validating my webpage and working through the errors. the scenario I have is that I have the structure where I...
Read more >
Web Form Validation: Best Practices and Tutorials
Please notice that it is often a good idea to not impose a strict input pattern on the users; it's better to actually...
Read more >
More on data validation - Microsoft Support
You can use data validation to restrict the type of data or values that users enter into cells. This is an advanced topic...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found