Skip to content

Commit

Permalink
tomlantic + docs: fix/update docstings and api docs
Browse files Browse the repository at this point in the history
woops!
  • Loading branch information
markjoshwel committed Mar 3, 2024
1 parent 89542e5 commit fe949c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ set `handle_errors` to `False` to raise the original
- [`tomlantic.TOMLValidationError`](#class-tomlantictomlvalidationerror)
if the document does not validate with the model
- [`pydantic.ValidationError`](https://docs.pydantic.dev/latest/api/pydantic_core/#pydantic_core.ValidationError)
if the document does not validate with the model
if the document does not validate with the model and `handle_errors` is `False`

- methods:
- [model_dump_toml()](#def-tomlanticmodelboundtomlmodel_dump_toml)
Expand All @@ -144,7 +144,7 @@ set `handle_errors` to `False` to raise the original
```python
# instantiate the class
toml = ModelBoundTOML(YourModel, tomlkit.parse(...))
# access your model with ModelBoundTOML.model
# access your model with .model
toml.model.message = "blowy red vixens fight for a quick jump"
# dump the model back to a toml document
toml_document = toml.model_dump_toml()
Expand Down
7 changes: 3 additions & 4 deletions tomlantic/tomlantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class ModelBoundTOML(Generic[M]):
```py
# instantiate the class
toml = ModelBoundTOML(YourModel, tomlkit.parse(...))
# access your model with ModelBoundTOML.model
# access your model with .model
toml.model.message = "blowy red vixens fight for a quick jump"
# dump the model back to a toml document
toml_document = toml.model_dump_toml()
Expand Down Expand Up @@ -248,9 +248,8 @@ def __init__(
- handle_errors: `bool` = False
raises:
- `tomlantic.TOMLMissingError` if the document does not contain all the required fields/tables of the model
- `tomlantic.TOMLValueError` if an item in the document is invalid for its respective model field
- `pydantic.ValidationError` if the document does not validate with the model
- `tomlantic.TOMLValidationError` if the document does not validate with the model
- `pydantic.ValidationError` if the document does not validate with the model and `handle_errors` is `False`
"""
try:
self.model = model.model_validate(document)
Expand Down

0 comments on commit fe949c2

Please sign in to comment.