Skip to content

Commit

Permalink
Document extism.Json
Browse files Browse the repository at this point in the history
  • Loading branch information
bhelx committed Oct 23, 2024
1 parent b70c5df commit 73ec6e4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,28 @@ extism call plugin.wasm sum --input='{"a": 20, "b": 21}' --wasi
# => {"sum":41}
```

You can also specify your input and output types as dataclasses using `extism.Json`:

```python
from typing import Optional, List
from dataclasses import dataclass

# ...

@dataclass
class User(extism.Json):
admin: bool
name: Optional[str]
email: str
addresses: List[Address]


@extism.plugin_fn
def reflect_user():
input = extism.input(User)
extism.output(input)
```

### Configs

Configs are key-value pairs that can be passed in by the host when creating a
Expand Down

0 comments on commit 73ec6e4

Please sign in to comment.