David Montague

Results 40 issues of David Montague

In https://github.com/pydantic/pydantic/issues/1511 there is some discussion about what schema should be generated for Decimal. One of the points that has been brought up is the idea that you could produce...

I was working on resolving the issue with cyclic recursive schemas, and I noticed a strange behavior during core schema generation. In the `test_forward_ref.test_forward_ref_auto_update_no_model` test, we have: ```python class Foo(BaseModel,...

One of the challenges I've been running into while working through JSON schema generation (#5029) has been the fact that in the `CoreSchema` created for BaseModels, a "ref" is not...

Currently, the JSON schema generated for a field of type `timedelta` looks like: `{'type': 'number', 'format': 'time-delta'}`. This appears to be the page that defines the official/"built-in" format choices: https://json-schema.org/understanding-json-schema/reference/string.html...

In v2, currently the following code: ```python from typing import TypeVar, List from pydantic import BaseModel T = TypeVar('T') class GenericList(List[T]): pass class Model(BaseModel): field: GenericList[int] ``` results in: ```...

It seems to me the following code: ```python from pydantic import BaseModel class A(BaseModel): x = True ``` should be raising this warning: https://github.com/pydantic/pydantic/blob/ef3cc495a9c86553b62a95a6052fd9b6ebc045e9/pydantic/_internal/_model_construction.py#L76-L80 However, currently it hits this branch:...

bug V1

Right now: ```python from pydantic import BaseModel class Model(BaseModel, undefined_types_warning=False): field: int ``` results in: ``` Traceback (most recent call last): File "/Users/davidmontague/repos/pydantic/pydantic/main.py", line 103, in __new__ cls: type[BaseModel] =...

The following code should work without errors: ```python from enum import Enum from pydantic import BaseModel class MyEnum(Enum): x = 1 y = 2 class Model(BaseModel): enum: MyEnum Model(enum=2) Model(enum=MyEnum.x)...

Copying from slack: > On a related note: I think we should have a way to perform JSON-mode validation even when validating from python. Is that currently possible? Otherwise I...

enhancement