updated docs strings and added README.md

This commit is contained in:
2026-03-08 17:59:52 +05:30
parent 80f8defcc2
commit 1c48f58578
23 changed files with 329 additions and 199 deletions

View File

@@ -2,7 +2,7 @@
"module": "openapi_first.client",
"content": {
"path": "openapi_first.client",
"docstring": "OpenAPI-first HTTP client for contract-driven services.\n\n---\n\n## Summary\n\nThis module provides `OpenAPIClient`, a thin, strict HTTP client that\nderives all callable operations directly from an OpenAPI 3.x specification.\n\nIt is the client counterpart to `OpenAPIFirstApp`.\n\nNotes:\n **Core Principles:**\n\n - The OpenAPI specification is the single source of truth\n - Each operationId becomes a callable Python method\n - No implicit schema mutation or inference\n - No code generation step\n - Minimal abstraction over httpx\n\n **Responsibilities:**\n\n - Parses an OpenAPI 3.x specification\n - Dynamically creates one callable per operationId\n - Enforces presence of servers, paths, and operationId\n - Formats path parameters safely\n - Handles JSON request bodies explicitly\n - Returns raw `httpx.Response` objects\n\n **Constraints:**\n\n - This module intentionally does NOT: Generate client code, validate request/response schemas, deserialize responses, retry requests, implement authentication helpers, or assume non-2xx responses are failures.",
"docstring": "# Summary\n\nOpenAPI-first HTTP client for contract-driven services.\n\nThis module provides `OpenAPIClient`, a thin, strict HTTP client that\nderives all callable operations directly from an OpenAPI 3.x specification.\n\nIt is the client counterpart to `OpenAPIFirstApp`.\n\nNotes:\n **Core Principles:**\n\n - The OpenAPI specification is the single source of truth\n - Each operationId becomes a callable Python method\n - No implicit schema mutation or inference\n - No code generation step\n - Minimal abstraction over httpx\n\n **Responsibilities:**\n\n - Parses an OpenAPI 3.x specification\n - Dynamically creates one callable per operationId\n - Enforces presence of servers, paths, and operationId\n - Formats path parameters safely\n - Handles JSON request bodies explicitly\n - Returns raw `httpx.Response` objects\n\n **Constraints:**\n\n - This module intentionally does NOT: Generate client code, validate request/response schemas, deserialize responses, retry requests, implement authentication helpers, or assume non-2xx responses are failures.",
"objects": {
"Any": {
"name": "Any",
@@ -51,21 +51,21 @@
"kind": "class",
"path": "openapi_first.client.OpenAPIFirstError",
"signature": "<bound method Alias.signature of Alias('OpenAPIFirstError', 'openapi_first.errors.OpenAPIFirstError')>",
"docstring": "Base exception for all OpenAPI-first enforcement errors.\n\nNotes:\n **Responsibilities:**\n\n - This exception exists to allow callers, test suites, and CI pipelines to catch and distinguish OpenAPI contract violations from unrelated runtime errors\n - All exceptions raised by the OpenAPI-first core should inherit from this type"
"docstring": "Base exception for all OpenAPI-first enforcement errors.\n\nNotes:\n **Responsibilities:**\n\n - This exception exists to allow callers, test suites, and CI\n pipelines to catch and distinguish OpenAPI contract violations\n from unrelated runtime errors.\n - All exceptions raised by the OpenAPI-first core should inherit\n from this type."
},
"OpenAPIClientError": {
"name": "OpenAPIClientError",
"kind": "class",
"path": "openapi_first.client.OpenAPIClientError",
"signature": "<bound method Class.signature of Class('OpenAPIClientError', 44, 47)>",
"signature": "<bound method Class.signature of Class('OpenAPIClientError', 42, 45)>",
"docstring": "Raised when an OpenAPI client operation fails."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.client.OpenAPIClient",
"signature": "<bound method Class.signature of Class('OpenAPIClient', 50, 257)>",
"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 ```",
"signature": "<bound method Class.signature of Class('OpenAPIClient', 48, 257)>",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\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",