{ "module": "openapi_first.templates.crud_app.test_crud_app", "content": { "path": "openapi_first.templates.crud_app.test_crud_app", "docstring": "End-to-end tests for the OpenAPI-first CRUD example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store.\n- OpenAPI specification loading\n- OperationId-driven route binding on the server\n- OperationId-driven client invocation\n- Correct HTTP status codes and response payloads\n\nThe tests exercise all CRUD operations against an in-memory mock data\nstore and assume deterministic behavior within a single process.\n\nThe tests assume:\n- OpenAPI-first route binding\n- In-memory storage (no persistence guarantees)\n- Deterministic behavior in a single process\n- One-to-one correspondence between OpenAPI operationId values and\n server/client callables", "objects": { "TestClient": { "name": "TestClient", "kind": "alias", "path": "openapi_first.templates.crud_app.test_crud_app.TestClient", "signature": "", "docstring": null }, "app": { "name": "app", "kind": "alias", "path": "openapi_first.templates.crud_app.test_crud_app.app", "signature": "", "docstring": null }, "load_openapi": { "name": "load_openapi", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.load_openapi", "signature": "", "docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported extensions: .json, .yaml, .yml.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated using a strict OpenAPI schema validator\n - Any error results in an immediate exception, preventing application startup" }, "OpenAPIClient": { "name": "OpenAPIClient", "kind": "class", "path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient", "signature": "", "docstring": "OpenAPI-first HTTP client (httpx-based).\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an OpenAPI 3.x specification. Each operationId becomes a method on the client instance.\n\n **Guarantees:**\n\n - One callable per operationId\n - Explicit parameters (path, query, headers, body)\n - No implicit schema inference or mutation\n - Returns raw `httpx.Response` objects\n - No response validation or deserialization\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```", "members": { "spec": { "name": "spec", "kind": "attribute", "path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.spec", "signature": "", "docstring": null }, "base_url": { "name": "base_url", "kind": "attribute", "path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.base_url", "signature": "", "docstring": null }, "client": { "name": "client", "kind": "attribute", "path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.client", "signature": "", "docstring": null }, "operations": { "name": "operations", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.operations", "signature": "", "docstring": null } } }, "client": { "name": "client", "kind": "attribute", "path": "openapi_first.templates.crud_app.test_crud_app.client", "signature": null, "docstring": null }, "spec": { "name": "spec", "kind": "attribute", "path": "openapi_first.templates.crud_app.test_crud_app.spec", "signature": null, "docstring": null }, "test_list_items_initial": { "name": "test_list_items_initial", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.test_list_items_initial", "signature": "", "docstring": "Initial items should be present." }, "test_get_item": { "name": "test_get_item", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.test_get_item", "signature": "", "docstring": "Existing item should be retrievable by ID." }, "test_create_item": { "name": "test_create_item", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.test_create_item", "signature": "", "docstring": "Creating a new item should return the created entity." }, "test_update_item": { "name": "test_update_item", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.test_update_item", "signature": "", "docstring": "Updating an item should replace its values." }, "test_delete_item": { "name": "test_delete_item", "kind": "function", "path": "openapi_first.templates.crud_app.test_crud_app.test_delete_item", "signature": "", "docstring": "Deleting an item should remove it from the store." } } } }