Skip to main content

This implements an API that's compatible to Akeneo. If it's not, it's a bug. This is NOT an official Akeneo Product

Project description

Mock Akeneo API

Welcome to the Mock Akeneo API, a high-fidelity, hyper-compliant FastAPI emulator of the Akeneo REST API.

Relation to Akeneo:

THIS IS NOT AN OFFICIAL AKENEO PRODUCT!

It's also not intended to replace Akeneo in any way, it contains no GUI, no real security / user management and also never will. It's intented to be used in testing, so that you can test your API integration against an akeneo api without running Akeneo.

Project Overview

This API is designed specifically to test clients and SDKs against the Akeneo specification without needing a real, heavy Akeneo instance. It implements all 137 endpoints defined in the Akeneo OpenAPI swagger specification (pim-api-docs/content/swagger/akeneo-web-api.json).

Crucially, this API has zero OpenAPI contract validation failures. It has been battle-tested against schemathesis using over 9,800 fuzzed inputs to guarantee that:

  • It returns correct status codes.
  • It never returns 500 crashes on garbage inputs.
  • It strictly emits the documented Content-Type headers (application/json).
  • All response schemas perfectly match the OpenAPI documentation.

Tech Stack

  • Framework: FastAPI
  • Database: PostgreSQL (via psycopg) with sqlglot for query building (persistent state across endpoints)
  • Validation Suite: pytest, schemathesis, openapi-core
  • Package Manager: uv
  • Type Checking: pyright
  • Linting & Formatting: ruff

Getting Started

1. Installation

The project strictly uses uv. To install dependencies:

uv sync

2. Running the Server

Start the local Uvicorn dev server:

uv run uvicorn akeneo_mock_server.app:app --reload

Or use the package script entrypoint:

uv run run_akeneo_mock

The API will be available at http://127.0.0.1:8000.

3. Running the Test Suite

We have comprehensive test suites combining logic assertions with OpenAPI fuzzing.

Run the internal logic tests:

uv run pytest tests/test_api.py -v

Run the schema validation fuzzer (requires the API to be running on port 8000):

make test-contract

Or run all QA checks (Formatting, Type Checking, Unit Tests):

make check

4. Updating the API Specification

If Akeneo releases a new OpenAPI schema, you can automatically ingest it, patch it for Schemathesis validation conformance (adding missing 422/415 fallbacks), and run tests against the fresh schema with one command:

make update-api-docs

Architecture Notes

Shared State

Since this is a mock, all created entities (Products, Categories, Subscriptions, etc.) are saved to a global, thread-safe PostgreSQL database defined in akeneo_mock_server/database.py.

OpenAPI Middleware

To guarantee strict compliance, the API uses a custom StarletteOpenAPIMiddleware. It intercepts raw incoming requests. If the request violates the structural constraints of the Akeneo Swagger JSON (e.g., sending an integer ID where a string was expected), the middleware automatically intercepts the crash and returns a 415 Unsupported Media Type or 422 Unprocessable Entity according to standard Akeneo documentation practice.

Bypassing Native Middleware

During Pytest execution, the TestClient uses the testclient User-Agent. Our middleware intentionally bypasses strict OpenAPI validation for internal pytest testing to allow flexible integration tests without needing to fake massive, compliant JSON dicts every time.

Development

Use uv. To install skills for AI Agents, run uv run skillup sync

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

akeneo_mock_server-0.8.7.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

akeneo_mock_server-0.8.7-py3-none-any.whl (32.7 kB view details)

Uploaded Python 3

File details

Details for the file akeneo_mock_server-0.8.7.tar.gz.

File metadata

  • Download URL: akeneo_mock_server-0.8.7.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for akeneo_mock_server-0.8.7.tar.gz
Algorithm Hash digest
SHA256 8978ed8a84ba503970ab9fab91554a5ba9670b3d80d1055b9a8cac7d9b36eff0
MD5 b2b9dd8c6f5ffd2499293e8464fafbf0
BLAKE2b-256 ae52bf8226a54f60b4b2275611859e17baeb9bc94e03baf16751cbca440c4d5f

See more details on using hashes here.

Provenance

The following attestation bundles were made for akeneo_mock_server-0.8.7.tar.gz:

Publisher: python-publish.yml on bmsuisse/akeneo_mock_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file akeneo_mock_server-0.8.7-py3-none-any.whl.

File metadata

File hashes

Hashes for akeneo_mock_server-0.8.7-py3-none-any.whl
Algorithm Hash digest
SHA256 06c6679f271a4b6726e40fd68de98165ec354b9dd0fa96819b0c251f1d7532da
MD5 b7d7615888fdc8fcbfda2fce8a7c2b59
BLAKE2b-256 10df15ef8f0ae91dacaf1b37038e0dd27b51ee8e520ee096cf1d8afef491b26f

See more details on using hashes here.

Provenance

The following attestation bundles were made for akeneo_mock_server-0.8.7-py3-none-any.whl:

Publisher: python-publish.yml on bmsuisse/akeneo_mock_server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page