INNER CODE UNIT · Python
new_lines
phillipdupuis/pydantic-to-typescript · pydantic2ts/cli/script.py:234
new_lines = banner_comment_lines + lines[:start] + lines[(end + 1) :]
with open(output_filename, "w") as f:
f.writelines(new_lines)
@contextmanager
def _schema_generation_overrides(
model: Type[Any],
) -> Generator[None, None, None]:
"""
Temporarily override the 'extra' setting for a model,
changing it to 'forbid' unless it was EXPLICITLY set to 'allow'.
This prevents '[k: string]: any' from automatically being added to every interface.
"""
revert: Dict[str, Any] = {}
config = _get_model_config(model)
try: