-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Docs for Pydantic Support (#1099)
* feat: docs for pydantic * fix: lint
- Loading branch information
1 parent
1499668
commit e2ac89e
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { GithubSnippet, getSnippets } from "@/components/code"; | ||
|
||
export const PydanticPy = { | ||
path: "examples/pydantic/worker.py", | ||
}; | ||
|
||
export const getStaticProps = ({}) => getSnippets([PydanticPy]); | ||
|
||
# Pydantic Support | ||
|
||
Hatchet allows for you to optionally validate workflow inputs and step outputs using [Pydantic](https://docs.pydantic.dev/latest/). | ||
|
||
### Usage | ||
|
||
To enable Pydantic for validation, you'll need to: | ||
|
||
1. Provide an `input_validator` as a parameter to your `workflow`. | ||
2. Add return type hints for your `steps`. | ||
|
||
In addition, for improved IDE support and static type checking, you'll need to use `typing.cast` to cast the `workflow_input` and `step_output` to their correct type. | ||
|
||
### Example Usage | ||
|
||
<GithubSnippet src={PydanticPy} target="Pydantic" /> |