chore(api): Cleanup schemas and update skills docs

This commit is contained in:
Adam Outler
2026-02-02 23:14:45 +01:00
parent 5095edd5d8
commit f43517b9a5
2 changed files with 35 additions and 7 deletions

View File

@@ -51,13 +51,24 @@ cd /workspaces/NetAlertX; pytest test/<path_to_test>
cd /workspaces/NetAlertX; pytest test/api_endpoints/test_mcp_extended_endpoints.py
```
## Authentication in Tests
## Authentication & Environment Reset
The test environment uses `API_TOKEN`. The most reliable way to retrieve the current token from a running container is:
Authentication tokens are required to perform certain operations such as manual testing or crafting expressions to work with the web APIs.After making code changes, you MUST reset the environment to ensure the new code is running and verify you have the latest `API_TOKEN`.
```bash
python3 -c "from helper import get_setting_value; print(get_setting_value('API_TOKEN'))"
```
1. **Reset Environment:** Run the setup script inside the container.
```bash
bash /workspaces/NetAlertX/.devcontainer/scripts/setup.sh
```
2. **Wait for Stabilization:** Wait at least 5 seconds for services (nginx, python server, etc.) to start.
```bash
sleep 5
```
3. **Obtain Token:** Retrieve the current token from the container.
```bash
python3 -c "from helper import get_setting_value; print(get_setting_value('API_TOKEN'))"
```
The retrieved token MUST be used in all subsequent API or test calls requiring authentication.
### Troubleshooting

View File

@@ -39,8 +39,7 @@ ALLOWED_DEVICE_COLUMNS = Literal[
]
ALLOWED_NMAP_MODES = Literal[
"quick", "intense", "ping", "comprehensive", "fast", "normal", "detail", "skipdiscovery",
"-sS", "-sT", "-sU", "-sV", "-O"
"fast", "normal", "detail", "skipdiscovery"
]
NOTIFICATION_LEVELS = Literal["info", "warning", "error", "alert", "interrupt"]
@@ -301,6 +300,24 @@ class DeviceTotalsResponse(RootModel):
root: List[int] = Field(default_factory=list, description="List of counts: [all, online, favorites, new, offline, archived]")
class DeviceTotalsNamedResponse(BaseResponse):
"""Response with named device statistics."""
totals: Dict[str, int] = Field(
...,
description="Dictionary of counts",
json_schema_extra={
"examples": [{
"devices": 10,
"connected": 5,
"favorites": 2,
"new": 1,
"down": 0,
"archived": 2
}]
}
)
class DeviceExportRequest(BaseModel):
"""Request for exporting devices."""
format: Literal["csv", "json"] = Field(