From 06e38a84c6aa2a33f60ba4928ae4b160814fa5ad Mon Sep 17 00:00:00 2001 From: Moritz Makowski Date: Wed, 7 Aug 2024 18:09:03 +0200 Subject: [PATCH] #19 Add `Version` validator (3) update docs --- docs/pages/api-reference.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/pages/api-reference.md b/docs/pages/api-reference.md index 7d40cef..b610009 100644 --- a/docs/pages/api-reference.md +++ b/docs/pages/api-reference.md @@ -1013,3 +1013,30 @@ m = MyModel.model_validate( ) # does not raise an error ``` + +## `Version` Objects + +```python +class Version(pydantic.RootModel[str]) +``` + +A version string in the format of MAJOR.MINOR.PATCH[-(alpha|beta|rc).N] + + +##### `as_tag` + +```python +def as_tag() -> str +``` + +Return the version string as a tag, i.e. vMAJOR.MINOR.PATCH... + + +##### `as_identifier` + +```python +def as_identifier() -> str +``` + +Return the version string as a number, i.e. MAJOR.MINOR.PATCH... +