Skip to content

Commit 2018346

Browse files
authored
Merge pull request #392 from mssalvatore/fix-pydantic-semver-example
Fix pydantic/semver example
2 parents 0ca281d + 35da4f6 commit 2018346

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

changelog.d/pr392.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the example in the documentation for combining semver and pydantic.

docs/advanced/combine-pydantic-and-semver.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@ To work with Pydantic, use the following steps:
1717
from semver import Version
1818
1919
class PydanticVersion(Version):
20+
@classmethod
21+
def _parse(cls, version):
22+
return cls.parse(version)
23+
2024
@classmethod
2125
def __get_validators__(cls):
2226
"""Return a list of validator methods for pydantic models."""
23-
yield cls.parse
27+
yield cls._parse
2428
2529
@classmethod
2630
def __modify_schema__(cls, field_schema):

0 commit comments

Comments
 (0)