Search Engine Serilizer Pydantic
This module is a technical module that define a new abstract class named PydandicModelSerializer that inherit from odoo.addons.connector_search_engine.tools.serializer.ModelSerializer
This new class define a new abstract method get_model_class. This method is used by the index to get the Pydantic model class to use to generate the json schema.
On the index form, if the serializer is a PydanticModelSerializer, a field is displayed to display the related json schema and therefore provide documentation about the fields exported and their characteristics.
Table of contents
Use Cases / Context
When you export records to a search engine, it’s common to want to provides documentation about the fields exported and their characteristics.
When the serializer used to export the records is a Pydantic model, you can use the json schema generated by Pydantic to provide this documentation.
Usage
When you define a serializer based on a Pydantic model, your serializer class must inherit from PydanticModelSerializer and implement the method get_model_class to take advantage of the functionality provided by this module.
Example:
from typing import Type
from pydantic import BaseModel
from odoo.addons.search_engine_serialize_pydantic.tools.serializer import (
PydanticModelSerializer,
)
class MyModel(BaseModel):
name: str
description: str
def record_to_model(self, record: Model) -> dict:
return cls(
name=record.name,
description=record.description,
)
class MyModelSerializer(PydanticModelSerializer):
def get_model_class(self) -> Type[MyModel]:
return MyModel
def serialize(self, record: Model) -> dict:
model: MyModel = self.get_model_class().record_to_model(record)
return model.model_dump()
Known issues / Roadmap
Add dedicated widget to display in a user friendly way the json schema generated by the serializer on the index form.
Bug Tracker
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
Credits
Contributors
Laurent Mignon laurent.mignon@acsone.eu (https://www.acsone.eu/)
Other credits
The development of this module has been financially supported by:
(ALCYON Belux)[https://www.alcyonbelux.be/fr/]
Maintainers
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
Current maintainer:
This module is part of the OCA/search-engine project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Metadata
Release files for odoo-addon-search-engine-serializer-pydantic 18.0.1.0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| odoo_addon_search_engine_serializer_pydantic-18.0.1.0.0.2-py3-none-any.whl | Python 3 | none | any | Details for odoo_addon_search_engine_serializer_pydantic-18.0.1.0.0.2-py3-none-any.whl |
Release files / odoo_addon_search_engine_serializer_pydantic-18.0.1.0.0.2-py3-none-any.whl
| Download URL | odoo_addon_search_engine_serializer_pydantic-18.0.1.0.0.2-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aebe15f1f79e650215fa5ba81d1cc9436f5688de7cf052211a99b8f211b88f99
|
|
BLAKE2b-256 checksum How to use checksums |
dc156e289c431d9d92923f8309c6cce6388d1d3c70b7138d1837d2543a2dc0b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for odoo-addon-search-engine-serializer-pydantic 18.0.1.0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.