MCPcopy Create free account
hub / github.com/cppla/ServerStatus / normalize_required_strings

Function normalize_required_strings

server/manage_api.py:34–41  ·  view source on GitHub ↗
(item, required, kind, index=None)

Source from the content-addressed store, hash-verified

32
33
34def normalize_required_strings(item, required, kind, index=None):
35 missing = [field for field in required if item.get(field) is None or not str(item.get(field, "")).strip()]
36 if missing:
37 raise ApiError(400, f"{kind} has missing required fields", {"missing": missing, "index": index})
38 normalized = dict(item)
39 for field in required:
40 normalized[field] = str(normalized[field]).strip()
41 return normalized
42
43
44def normalize_optional_string(item, field):

Callers 4

validate_serverFunction · 0.85
validate_monitorFunction · 0.85
validate_sslcertFunction · 0.85
validate_watchdogFunction · 0.85

Calls 1

ApiErrorClass · 0.85

Tested by

no test coverage detected