-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Infer basic json schema on primitive types
- Loading branch information
1 parent
085ed63
commit e8d8b8d
Showing
7 changed files
with
111 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,33 @@ | ||
# | ||
# Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH | ||
# | ||
# This file is part of the Restate SDK for Python, | ||
# which is released under the MIT license. | ||
# | ||
# You can find a copy of the license in file LICENSE in the root | ||
# directory of this repository or package, or at | ||
# https://github.com/restatedev/sdk-typescript/blob/main/LICENSE | ||
# | ||
"""greeter.py""" | ||
# pylint: disable=C0116 | ||
# pylint: disable=W0613 | ||
# pylint: disable=C0115 | ||
# pylint: disable=R0903 | ||
|
||
from pydantic import BaseModel | ||
from restate import Service, Context | ||
|
||
# models | ||
class GreetingRequest(BaseModel): | ||
name: str | ||
|
||
class Greeting(BaseModel): | ||
message: str | ||
|
||
# service | ||
|
||
pydantic_greeter = Service("pydantic_greeter") | ||
|
||
@pydantic_greeter.handler() | ||
async def greet(ctx: Context, req: GreetingRequest) -> Greeting: | ||
return Greeting(message=f"Hello {req.name}!") |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
hypercorn | ||
restate_sdk | ||
restate_sdk | ||
pydantic |
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
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
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ mypy | |
pylint | ||
hypercorn | ||
maturin | ||
pytest | ||
pytest | ||
pydantic |