MCPcopy Index your code
hub / github.com/dataease/SQLBot / replace_placeholders_in_schema

Function replace_placeholders_in_schema

backend/main.py:84–97  ·  view source on GitHub ↗

search OpenAPI schema,replace PLACEHOLDER_xxx to text。

(schema: Dict[str, Any], trans: Dict[str, str])

Source from the content-addressed store, hash-verified

82
83# replace placeholder
84def replace_placeholders_in_schema(schema: Dict[str, Any], trans: Dict[str, str]) -> None:
85 """
86 search OpenAPI schema,replace PLACEHOLDER_xxx to text。
87 """
88 if isinstance(schema, dict):
89 for key, value in schema.items():
90 if isinstance(value, str) and value.startswith(PLACEHOLDER_PREFIX):
91 placeholder_key = value[len(PLACEHOLDER_PREFIX):]
92 schema[key] = trans.get(placeholder_key, value)
93 else:
94 replace_placeholders_in_schema(value, trans)
95 elif isinstance(schema, list):
96 for item in schema:
97 replace_placeholders_in_schema(item, trans)
98
99
100

Callers 1

Calls 2

getMethod · 0.65
itemsMethod · 0.45

Tested by

no test coverage detected