Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2018346

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

File tree

2 files changed

+6
-1
lines changed
Filter options

2 files changed

+6
-1
lines changed

‎changelog.d/pr392.doc.rst

Copy file name to clipboard
+1Lines 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

Copy file name to clipboardExpand all lines: docs/advanced/combine-pydantic-and-semver.rst
+5-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.