# pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'decimal.Decimal'>. Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

- **ID:** `python/pydantic-arbitrary-types-schema-generation`
- **Domain:** python
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The field type is a custom class (or a third-party type) that Pydantic v2 does not know how to validate, and no core schema has been registered.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   from pydantic import BaseModel, ConfigDict
class Foo(BaseModel):
    model_config = ConfigDict(arbitrary_types_allowed=True)
    value: MyCustomClass
   ```
2. **** (90% success)
   ```
   from pydantic import GetCoreSchemaHandler
from pydantic_core import core_schema
class MyCustomClass:
    @classmethod
    def __get_pydantic_core_schema__(cls, source, handler):
        return core_schema.no_info_plain_validator_function(cls.validate)
   ```
3. **** (85% success)
   ```
   from typing import Annotated
from pydantic import BeforeValidator
MyType = Annotated[decimal.Decimal, BeforeValidator(lambda v: decimal.Decimal(str(v)))]
   ```

## Dead Ends

- **** — Pydantic v2 uses model_config = ConfigDict(...); the inner Config class is deprecated and ignored in strict v2 builds. (55% fail)
- **** — Disables validation entirely, so invalid instances pass silently and errors surface later in business logic. (70% fail)
- **** — NewType is a static-typing alias; at runtime it is just the underlying type and does not register a schema. (85% fail)
