autodoc_pydantic icon indicating copy to clipboard operation
autodoc_pydantic copied to clipboard

Pattern validators not properly escaped

Open jnicoulaud-ledger opened this issue 5 months ago • 1 comments

When using this kind of types in models:

MyType = Annotated[str, Field(min_length=3, max_length=256, pattern=r"^[a-z0-9_]+$")]

It looks like the generator does not properly escape the regex as needed:

docstring of MyModel.some_field:1:Unknown target name: "a-z0-9".

jnicoulaud-ledger avatar Sep 10 '24 10:09 jnicoulaud-ledger