pydantic-core icon indicating copy to clipboard operation
pydantic-core copied to clipboard

False-positive `SchemaError` for keyword-only args: Non-default argument follows default argument

Open rsokl opened this issue 2 months ago • 0 comments

  • pydantic-2.6.4
  • pydantic-core-2.16.3

Defining

@pydantic.validate_call()
def foo(*, x: int = 1, y: str):
    print(x, y)

raises:

SchemaError: Error building "call" validator:
  SchemaError: Error building "arguments" validator:
  SchemaError: Non-default argument 'y' follows default argument

however, this should be tolerated as both x and y are keyword-only arguments.

rsokl avatar Apr 02 '24 14:04 rsokl