From 96a2be645540868900476e517006c89b2e963124 Mon Sep 17 00:00:00 2001 From: Sina Atalay Date: Mon, 20 May 2024 21:58:18 +0300 Subject: [PATCH] data_models: refactor --- rendercv/data_models.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/rendercv/data_models.py b/rendercv/data_models.py index 9901d57..a341658 100644 --- a/rendercv/data_models.py +++ b/rendercv/data_models.py @@ -183,7 +183,7 @@ class BulletEntry(RenderCVBaseModel): class EntryWithDate(RenderCVBaseModel): - date: Optional[int | RenderCVDate | str] = pydantic.Field( + date: Optional[int | str] = pydantic.Field( default=None, title="Date", description=( @@ -1509,7 +1509,7 @@ def get_a_sample_data_model( ), authors=[ "Albert Smith", - name, + f"***{name}***", "Jane Derry", "Harry Tom", "Frodo Baggins", @@ -1663,15 +1663,6 @@ def generate_json_schema() -> dict[str, Any]: field["oneOf"] = field["anyOf"] del field["anyOf"] - # In date field, we both allow string and RenderCVDate type. Since we - # use "oneOf", matching both RenderCVDate and string is a problem - # for the JSON schema. So, we remove the RenderCVDate type from the - # "oneOf" list. - if "date" in value["properties"]: - for i, one_of in enumerate(value["properties"]["date"]["oneOf"]): - if "pattern" in one_of: - del value["properties"]["date"]["oneOf"][i] - return json_schema schema = RenderCVDataModel.model_json_schema(