docs: add OpenAPI-first wiki (overview, components, use cases for templates/client/codegen, design, security, error handling, testing) and refresh lib docs index

This commit is contained in:
2026-09-15 22:29:05 +05:30
parent adeb02e162
commit b559323dfe
26 changed files with 1590 additions and 86 deletions

View File

@@ -28,15 +28,15 @@ Scaffolding via CLI
Create a new model-based CRUD example service using the bundled template:
openapi-first model_app
openapi-first scaffold model_app
Create the service in a custom directory:
openapi-first model_app my-model-service
openapi-first scaffold model_app my-model-service
List all available application templates:
openapi-first --list
openapi-first scaffold --list
The CLI copies template files verbatim into the target directory.
No code is generated or modified beyond the copied scaffold.

View File

@@ -62,6 +62,8 @@ def get_item(item_id: int) -> Item:
KeyError
If the item does not exist.
"""
if item_id not in _items:
raise KeyError(item_id)
return _items[item_id]
@@ -134,4 +136,6 @@ def delete_item(item_id: int) -> None:
KeyError
If the item does not exist.
"""
if item_id not in _items:
raise KeyError(item_id)
del _items[item_id]

View File

@@ -26,7 +26,7 @@ from data import (
)
def list_items():
def list_items() -> list[Item]:
"""
List all items.
@@ -41,7 +41,7 @@ def list_items():
return _list_items()
def get_item(item_id: int):
def get_item(item_id: int) -> Item:
"""
Retrieve a single item by ID.
@@ -69,7 +69,7 @@ def get_item(item_id: int):
raise HTTPException(status_code=404, detail="Item not found")
def create_item(payload: ItemCreate, response: Response):
def create_item(payload: ItemCreate, response: Response) -> Item:
"""
Create a new item.
@@ -80,7 +80,7 @@ def create_item(payload: ItemCreate, response: Response):
----------
payload : ItemCreate
Request body describing the item to create.
response : fastapi.Response
response : Response
Response object used to set the HTTP status code.
Returns
@@ -93,7 +93,7 @@ def create_item(payload: ItemCreate, response: Response):
return item
def update_item(item_id: int, payload: ItemCreate):
def update_item(item_id: int, payload: ItemCreate) -> Item:
"""
Update an existing item.
@@ -123,7 +123,7 @@ def update_item(item_id: int, payload: ItemCreate):
raise HTTPException(status_code=404, detail="Item not found")
def delete_item(item_id: int, response: Response):
def delete_item(item_id: int, response: Response) -> None:
"""
Delete an existing item.
@@ -134,7 +134,7 @@ def delete_item(item_id: int, response: Response):
----------
item_id : int
Identifier of the item to delete.
response : fastapi.Response
response : Response
Response object used to set the HTTP status code.
Returns