-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] base_rest_pydantic: migrate to 18.0
- Loading branch information
1 parent
dc36045
commit 2928646
Showing
13 changed files
with
101 additions
and
96 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
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,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
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 @@ | ||
- Laurent Mignon \<laurent.mignon@acsone.eu\> |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
base_rest_pydantic/readme/DESCRIPTION.rst → base_rest_pydantic/readme/DESCRIPTION.md
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,2 @@ | ||
This addon allows you to use Pydantic objects as params and/or response with your | ||
REST API methods. | ||
This addon allows you to use Pydantic objects as params and/or response | ||
with your REST API methods. |
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,32 @@ | ||
To use Pydantic instances as request and/or response of a REST service | ||
endpoint you must: | ||
|
||
- Define your Pydantic classes; | ||
- Provides the information required to the | ||
`odoo.addons.base_rest.restapi.method` decorator; | ||
|
||
``` python | ||
from odoo.addons.base_rest import restapi | ||
from odoo.addons.component.core import Component | ||
from odoo.addons.pydantic.models import BaseModel | ||
|
||
class PingMessage(BaseModel): | ||
message: str | ||
|
||
|
||
class PingService(Component): | ||
_inherit = 'base.rest.service' | ||
_name = 'ping.service' | ||
_usage = 'ping' | ||
_collection = 'my_module.services' | ||
|
||
|
||
@restapi.method( | ||
[(["/pong"], "GET")], | ||
input_param=restapi.PydanticModel(PingMessage), | ||
output_param=restapi.PydanticModel(PingMessage), | ||
auth="public", | ||
) | ||
def pong(self, ping_message): | ||
return PingMessage(message = "Received: " + ping_message.message) | ||
``` |
This file was deleted.
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
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,5 +2,6 @@ | |
a2wsgi>=1.10.6 | ||
fastapi>=0.110.0 | ||
parse-accept-language | ||
pydantic>=2.0.0 | ||
python-multipart | ||
ujson |