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.

allow arbitary types

See original GitHub issue

Remove the exception pydantic.exceptions.ConfigError: no validator found for <class 'Foobar'> and just require that any value provided is an instance of Foobar.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

141reactions
samuelcolvincommented, Jul 15, 2019

please read the documentation.

59reactions
dmontagucommented, Jul 15, 2019

@mr-bjerre A ctrl+f for arbitrary_types_allowed on the pydantic docs should get you to the right place.

Here’s an demonstration that I believe should work (not tested):

from pydantic import BaseModel

class MyClass: 
    pass

class Model(BaseModel):
    v: MyClass

    class Config:
        arbitrary_types_allowed = True
Read more comments on GitHub >

github_iconTop Results From Across the Web

Model Config - pydantic
... whether to allow arbitrary user types for fields (they are validated simply by checking if the value is an instance of the...
Read more >
"[...] see `arbitrary_types_allowed` in Config" error message ...
The docs discuss arbitrary types and dataclass , but only in the context where a BaseModel validates an stdlib dataclass .
Read more >
NSAllowsArbitraryLoads | Apple Developer Documentation
NSAllowsArbitraryLoads. A Boolean value indicating whether App Transport Security restrictions are disabled for all network connections. iOS 9.0+ ...
Read more >
Allow arbitrary properties in class Typescript types
I've created a generic class in Typescript to extend objects starting from one passed in the constructor (through a Proxy, which will be ......
Read more >
typing — Support for type hints — Python 3.11.1 documentation
PEP 604: Allow writing union types as X | Y. Introducing types. ... Introducing Self. PEP 675: Arbitrary Literal String Type. Introducing LiteralString....
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