Skip to content

Commit 01a3b94

Browse files
[MIG] base_rest_pydantic: migrate to 18.0
1 parent 1ee8fdf commit 01a3b94

File tree

18 files changed

+119
-115
lines changed

18 files changed

+119
-115
lines changed

base_rest_auth_api_key/README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ Base Rest Auth Api Key
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
32-
This technical addon extend `base_rest` to add the support for auth_api_key
33-
authentication mechanism into the generated openapi documentation.
31+
This technical addon extend base_rest to add the support for
32+
auth_api_key authentication mechanism into the generated openapi
33+
documentation.
3434

3535
**Table of contents**
3636

@@ -51,17 +51,17 @@ Credits
5151
=======
5252

5353
Authors
54-
~~~~~~~
54+
-------
5555

5656
* ACSONE SA/NV
5757

5858
Contributors
59-
~~~~~~~~~~~~
59+
------------
6060

61-
* Laurent Mignon <[email protected]>
61+
- Laurent Mignon <[email protected]>
6262

6363
Maintainers
64-
~~~~~~~~~~~
64+
-----------
6565

6666
This module is maintained by the OCA.
6767

base_rest_auth_api_key/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.

base_rest_auth_api_key/readme/DESCRIPTION.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

base_rest_auth_api_key/static/description/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ <h1 class="title">Base Rest Auth Api Key</h1>
370370
!! source digest: sha256:fbb98424eace411d826bacf3ca3a8fac0c195873026870ef999be5b96aef0ee5
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372372
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/18.0/base_rest_auth_api_key"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-base_rest_auth_api_key"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373-
<p>This technical addon extend <cite>base_rest</cite> to add the support for auth_api_key
374-
authentication mechanism into the generated openapi documentation.</p>
373+
<p>This technical addon extend base_rest to add the support for
374+
auth_api_key authentication mechanism into the generated openapi
375+
documentation.</p>
375376
<p><strong>Table of contents</strong></p>
376377
<div class="contents local topic" id="contents">
377378
<ul class="simple">

base_rest_pydantic/README.rst

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ Base Rest Datamodel
1717
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
1818
:alt: License: LGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
20-
:target: https://github.com/OCA/rest-framework/tree/16.0/base_rest_pydantic
20+
:target: https://github.com/OCA/rest-framework/tree/18.0/base_rest_pydantic
2121
:alt: OCA/rest-framework
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-base_rest_pydantic
23+
:target: https://translation.odoo-community.org/projects/rest-framework-18-0/rest-framework-18-0-base_rest_pydantic
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=16.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&target_branch=18.0
2727
:alt: Try me on Runboat
2828

2929
|badge1| |badge2| |badge3| |badge4| |badge5|
3030

31-
This addon allows you to use Pydantic objects as params and/or response with your
32-
REST API methods.
31+
This addon allows you to use Pydantic objects as params and/or response
32+
with your REST API methods.
3333

3434
**Table of contents**
3535

@@ -39,65 +39,64 @@ REST API methods.
3939
Usage
4040
=====
4141

42-
To use Pydantic instances as request and/or response of a REST service endpoint
43-
you must:
42+
To use Pydantic instances as request and/or response of a REST service
43+
endpoint you must:
4444

45-
* Define your Pydantic classes;
46-
* Provides the information required to the ``odoo.addons.base_rest.restapi.method`` decorator;
45+
- Define your Pydantic classes;
46+
- Provides the information required to the
47+
``odoo.addons.base_rest.restapi.method`` decorator;
4748

49+
.. code:: python
4850
49-
.. code-block:: python
51+
from odoo.addons.base_rest import restapi
52+
from odoo.addons.component.core import Component
53+
from odoo.addons.pydantic.models import BaseModel
5054
55+
class PingMessage(BaseModel):
56+
message: str
5157
52-
from odoo.addons.base_rest import restapi
53-
from odoo.addons.component.core import Component
54-
from odoo.addons.pydantic.models import BaseModel
5558
56-
class PingMessage(BaseModel):
57-
message: str
59+
class PingService(Component):
60+
_inherit = 'base.rest.service'
61+
_name = 'ping.service'
62+
_usage = 'ping'
63+
_collection = 'my_module.services'
5864
5965
60-
class PingService(Component):
61-
_inherit = 'base.rest.service'
62-
_name = 'ping.service'
63-
_usage = 'ping'
64-
_collection = 'my_module.services'
65-
66-
67-
@restapi.method(
68-
[(["/pong"], "GET")],
69-
input_param=restapi.PydanticModel(PingMessage),
70-
output_param=restapi.PydanticModel(PingMessage),
71-
auth="public",
72-
)
73-
def pong(self, ping_message):
74-
return PingMessage(message = "Received: " + ping_message.message)
66+
@restapi.method(
67+
[(["/pong"], "GET")],
68+
input_param=restapi.PydanticModel(PingMessage),
69+
output_param=restapi.PydanticModel(PingMessage),
70+
auth="public",
71+
)
72+
def pong(self, ping_message):
73+
return PingMessage(message = "Received: " + ping_message.message)
7574
7675
Bug Tracker
7776
===========
7877

7978
Bugs are tracked on `GitHub Issues <https://github.com/OCA/rest-framework/issues>`_.
8079
In case of trouble, please check there if your issue has already been reported.
8180
If you spotted it first, help us to smash it by providing a detailed and welcomed
82-
`feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20base_rest_pydantic%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
81+
`feedback <https://github.com/OCA/rest-framework/issues/new?body=module:%20base_rest_pydantic%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
8382

8483
Do not contact contributors directly about support or help with technical issues.
8584

8685
Credits
8786
=======
8887

8988
Authors
90-
~~~~~~~
89+
-------
9190

9291
* ACSONE SA/NV
9392

9493
Contributors
95-
~~~~~~~~~~~~
94+
------------
9695

97-
* Laurent Mignon <[email protected]>
96+
- Laurent Mignon <[email protected]>
9897

9998
Maintainers
100-
~~~~~~~~~~~
99+
-----------
101100

102101
This module is maintained by the OCA.
103102

@@ -109,6 +108,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
109108
mission is to support the collaborative development of Odoo features and
110109
promote its widespread use.
111110

112-
This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/16.0/base_rest_pydantic>`_ project on GitHub.
111+
This module is part of the `OCA/rest-framework <https://github.com/OCA/rest-framework/tree/18.0/base_rest_pydantic>`_ project on GitHub.
113112

114113
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

base_rest_pydantic/__manifest__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
"name": "Base Rest Datamodel",
66
"summary": """
77
Pydantic binding for base_rest""",
8-
"version": "16.0.2.0.1",
8+
"version": "18.0.1.0.0",
99
"license": "LGPL-3",
1010
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
1111
"website": "https://github.com/OCA/rest-framework",
1212
"depends": ["base_rest"],
13-
"installable": False,
1413
"external_dependencies": {
1514
"python": [
1615
"pydantic>=2.0.0",

base_rest_pydantic/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Laurent Mignon \<[email protected]\>

base_rest_pydantic/readme/CONTRIBUTORS.rst

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This addon allows you to use Pydantic objects as params and/or response with your
2-
REST API methods.
1+
This addon allows you to use Pydantic objects as params and/or response
2+
with your REST API methods.

0 commit comments

Comments
 (0)