Files
docs/openapi-first/mcp/modules/openapi_first.templates.vet_app.test_vet_app.json
Vishesh 'ironeagle' Bangotra fced40af59 feat(standards): codify codegen, ship generic Tier-B infra, add get_app_template + prompts; fix docs:// regressions
P0: fix doc:// -> docs:// across standards src/server/registry and regenerate stale mongo-ops bundle. P1: build recipe + spec-first routing now document the openapi-first codegen fast path (models/routes with --inject-request/--package). P4: CRUD template documents the model-vs-document id rule (BaseDocument owns id). P5: authless guidance (omit security keys). P6: template gains generic infra (http_cache, keyed SSE bus, KV port+in-memory+Redis), interfaces/openapi.py + .dockerignore + generic build test registered as components, and a get_app_template tool; genericity matrix marks LLM pool + human-in-loop as reference-app patterns. P7: intake/build/start_app/trial prompts. P8: template ships tests/integration/test_openapi_app_builds.py. Rebuilt standards + openapi-first bundles and re-collected.
2026-10-13 03:26:51 +05:30

165 lines
8.5 KiB
JSON

{
"module": "openapi_first.templates.vet_app.test_vet_app",
"content": {
"path": "openapi_first.templates.vet_app.test_vet_app",
"docstring": "End-to-end tests for the OpenAPI-first Veterinary Clinic example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store using Pydantic models.",
"objects": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"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\n 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\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.templates.vet_app.test_vet_app.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n 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.vet_app.test_vet_app.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.test_vet_app.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.test_vet_app.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.OpenAPIClient.operations",
"signature": "operations()",
"docstring": null
}
}
},
"test_client": {
"name": "test_client",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.test_vet_app.test_client",
"signature": null,
"docstring": null
},
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.test_vet_app.spec",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.test_vet_app.client",
"signature": null,
"docstring": null
},
"test_list_parents": {
"name": "test_list_parents",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_list_parents",
"signature": "test_list_parents()",
"docstring": "List parents returns paginated response."
},
"test_create_parent": {
"name": "test_create_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_create_parent",
"signature": "test_create_parent()",
"docstring": "Creating a parent returns 201 with the created entity."
},
"test_get_parent": {
"name": "test_get_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_get_parent",
"signature": "test_get_parent()",
"docstring": "Get parent by ID returns the entity."
},
"test_update_parent": {
"name": "test_update_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_update_parent",
"signature": "test_update_parent()",
"docstring": "Update parent replaces its values."
},
"test_delete_parent": {
"name": "test_delete_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_delete_parent",
"signature": "test_delete_parent()",
"docstring": "Delete parent returns 204 and removes the entity."
},
"test_list_vets": {
"name": "test_list_vets",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_list_vets",
"signature": "test_list_vets()",
"docstring": "List vets returns paginated response."
},
"test_create_vet": {
"name": "test_create_vet",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_create_vet",
"signature": "test_create_vet()",
"docstring": "Creating a vet returns 201."
},
"test_list_treatments": {
"name": "test_list_treatments",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_list_treatments",
"signature": "test_list_treatments()",
"docstring": "List treatments returns an array."
},
"test_create_treatment": {
"name": "test_create_treatment",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_create_treatment",
"signature": "test_create_treatment()",
"docstring": "Creating a treatment returns 201."
},
"test_create_pet": {
"name": "test_create_pet",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_create_pet",
"signature": "test_create_pet()",
"docstring": "Creating a pet links FK references."
},
"test_upload_pet_photo": {
"name": "test_upload_pet_photo",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_upload_pet_photo",
"signature": "test_upload_pet_photo()",
"docstring": "Upload pet photo returns 200."
},
"test_list_appointments": {
"name": "test_list_appointments",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_list_appointments",
"signature": "test_list_appointments()",
"docstring": "List appointments returns paginated response with filter params."
},
"test_full_appointment_lifecycle": {
"name": "test_full_appointment_lifecycle",
"kind": "function",
"path": "openapi_first.templates.vet_app.test_vet_app.test_full_appointment_lifecycle",
"signature": "test_full_appointment_lifecycle()",
"docstring": "Create a parent, vet, treatment, pet, then an appointment."
}
}
}
}