fastapi
This module integrates the FastAPI framework with Odoo to enable the creation of RESTful API endpoints using standard Python type hints.
Key Features
- fastapi.endpoint: Allows defining and configuring FastAPI endpoints with custom paths, users, apps, and authentication methods.
- demo: Provides a demo FastAPI app with configurable authentication methods (API key or HTTP Basic) and sample endpoints for testing.
- dependencies: Offers reusable dependency injection functions for accessing Odoo environment, authenticated partners, paging, and basic authentication.
- schemas: Defines Pydantic models for pagination support and demo-specific data structures.
- security: Extends record rules to include authenticated partner context for enforcing access controls.
- language: Handles Accept-Language headers to automatically set the appropriate language in the Odoo environment.
- middleware: Manages ASGI to WSGI conversion and event loop pooling for FastAPI applications.
- dispatcher: Routes HTTP requests to appropriate FastAPI apps while managing Odoo environment and transaction lifecycle.
- error handling: Converts Odoo exceptions to proper HTTP status codes and responses.
- testing: Provides base test classes for unit testing FastAPI endpoints with Odoo integration.