search OpenAPI schema,replace PLACEHOLDER_xxx to text。
(schema: Dict[str, Any], trans: Dict[str, str])
| 82 | |
| 83 | # replace placeholder |
| 84 | def 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 |
no test coverage detected