diff --git a/examples/pydantic_to_json_schema.py b/examples/pydantic_to_json_schema.py index a97e612d..7a7c3711 100644 --- a/examples/pydantic_to_json_schema.py +++ b/examples/pydantic_to_json_schema.py @@ -125,7 +125,10 @@ def generate(self, schema, mode="validation"): return json_schema -with open("examples/Allele.json", "w") as wf: - json.dump( - Allele.model_json_schema(schema_generator=GksGenerateJsonSchema), wf, indent=2 - ) +if __name__ == "__main__": + with open("examples/Allele.json", "w") as wf: + json.dump( + Allele.model_json_schema(schema_generator=GksGenerateJsonSchema), + wf, + indent=2, + )