diff --git a/rendercv/data_models.py b/rendercv/data_models.py index 6ea0a72..bfeca32 100644 --- a/rendercv/data_models.py +++ b/rendercv/data_models.py @@ -147,6 +147,7 @@ class EntryBase(RenderCVBaseModel): "The start date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format." ), examples=["2020-09-24"], + json_schema_extra={"default": "2000-01-01"}, ) end_date: Optional[Literal["present"] | int | RenderCVDate] = pydantic.Field( default=None, @@ -157,6 +158,7 @@ class EntryBase(RenderCVBaseModel): " date." ), examples=["2020-09-24", "present"], + json_schema_extra={"default": "2020-01-01"}, ) date: Optional[RenderCVDate | int | str] = pydantic.Field( default=None, @@ -168,6 +170,7 @@ class EntryBase(RenderCVBaseModel): " the same time." ), examples=["2020-09-24", "My Custom Date"], + json_schema_extra={"default": "Custom Date or 2020-01-01"}, ) highlights: Optional[list[str]] = pydantic.Field( default=None, @@ -179,10 +182,8 @@ class EntryBase(RenderCVBaseModel): default=None, title="Location", description="The location of the event.", - examples=["Istanbul, Turkey"], + examples=["Istanbul, Türkiye"], ) - url: Optional[pydantic.HttpUrl] = None - url_text_input: Optional[str] = pydantic.Field(default=None, alias="url_text") @pydantic.model_validator( mode="after", @@ -421,30 +422,6 @@ class EntryBase(RenderCVBaseModel): return time_span_string - @functools.cached_property - def url_text(self) -> Optional[str]: - """ - Return a URL text based on the `url_text_input` and `url` fields. - """ - url_text = None - if self.url_text_input is not None: - # If the user provides a custom URL text, then use it. - url_text = self.url_text_input - elif self.url is not None: - url_text_dictionary = { - "github": "view on GitHub", - "linkedin": "view on LinkedIn", - "instagram": "view on Instagram", - "youtube": "view on YouTube", - } - url_text = "view on my website" - for key in url_text_dictionary: - if key in str(self.url): - url_text = url_text_dictionary[key] - break - - return url_text - class OneLineEntry(RenderCVBaseModel): """This class is the data model of `OneLineEntry`.""" @@ -487,7 +464,6 @@ class EducationEntry(EntryBase): institution: str = pydantic.Field( title="Institution", description="The institution name. It will be shown as bold text.", - examples=["Bogazici University"], ) area: str = pydantic.Field( title="Area", @@ -498,6 +474,7 @@ class EducationEntry(EntryBase): title="Degree", description="The type of the degree.", examples=["BS", "BA", "PhD", "MS"], + json_schema_extra={"default": "PhD"}, ) @@ -523,6 +500,7 @@ class PublicationEntry(RenderCVBaseModel): "The date of the publication in YYYY-MM-DD, YYYY-MM, or YYYY format." ), examples=["2021-10-31", "2010"], + json_schema_extra={"default": "2020-01-01"}, ) journal: Optional[str] = pydantic.Field( default=None, @@ -896,16 +874,22 @@ class CurriculumVitae(RenderCVBaseModel): email: Optional[pydantic.EmailStr] = pydantic.Field( default=None, title="Email", - description="The email of the person. It will be rendered in the heading.", + description="The email of the person.", + ) + phone: Optional[pydantic_phone_numbers.PhoneNumber] = pydantic.Field( + default=None, + title="Phone", + description="The phone number of the person.", + ) + website: Optional[pydantic.HttpUrl] = pydantic.Field( + default=None, + title="Website", + description="The website of the person.", ) - phone: Optional[pydantic_phone_numbers.PhoneNumber] = None - website: Optional[pydantic.HttpUrl] = None social_networks: Optional[list[SocialNetwork]] = pydantic.Field( default=None, title="Social Networks", - description=( - "The social networks of the person. They will be rendered in the heading." - ), + description="The social networks of the person.", ) sections_input: dict[str, SectionInput] = pydantic.Field( default=None, diff --git a/schema.json b/schema.json index 26fd5c8..0edfa94 100644 --- a/schema.json +++ b/schema.json @@ -146,6 +146,7 @@ "additionalProperties": false }, "ClassicThemeOptions": { + "additionalProperties": false, "description": "", "properties": { "theme": { @@ -275,8 +276,7 @@ "theme" ], "title": "ClassicThemeOptions", - "type": "object", - "additionalProperties": false + "type": "object" }, "ClassicThemePageMargins": { "properties": { @@ -365,7 +365,7 @@ }, "email": { "default": null, - "description": "The email of the person. It will be rendered in the heading.", + "description": "The email of the person.", "title": "Email", "allOf": [ { @@ -376,6 +376,7 @@ }, "phone": { "default": null, + "description": "The phone number of the person.", "title": "Phone", "allOf": [ { @@ -388,6 +389,7 @@ }, "website": { "default": null, + "description": "The website of the person.", "title": "Website", "allOf": [ { @@ -400,7 +402,7 @@ }, "social_networks": { "default": null, - "description": "The social networks of the person. They will be rendered in the heading.", + "description": "The social networks of the person.", "title": "Social Networks", "allOf": [ { @@ -491,7 +493,7 @@ "description": "This class is the data model of `EducationEntry`.", "properties": { "start_date": { - "default": null, + "default": "2000-01-01", "description": "The start date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format.", "examples": [ "2020-09-24" @@ -511,7 +513,7 @@ ] }, "end_date": { - "default": null, + "default": "2020-01-01", "description": "The end date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format. If the event is still ongoing, then type \"present\" or provide only the start date.", "examples": [ "2020-09-24", @@ -535,7 +537,7 @@ ] }, "date": { - "default": null, + "default": "Custom Date or 2020-01-01", "description": "If the event is a one-day event, then this field should be filled in YYYY-MM-DD format. If the event is a multi-day event, then the start date and end date should be provided instead. All of them can't be provided at the same time.", "examples": [ "2020-09-24", @@ -575,7 +577,7 @@ "default": null, "description": "The location of the event.", "examples": [ - "Istanbul, Turkey" + "Istanbul, T\u00fcrkiye" ], "title": "Location", "allOf": [ @@ -584,32 +586,8 @@ } ] }, - "url": { - "default": null, - "title": "Url", - "allOf": [ - { - "format": "uri", - "maxLength": 2083, - "minLength": 1, - "type": "string" - } - ] - }, - "url_text": { - "default": null, - "title": "Url Text", - "allOf": [ - { - "type": "string" - } - ] - }, "institution": { "description": "The institution name. It will be shown as bold text.", - "examples": [ - "Bogazici University" - ], "title": "Institution", "type": "string" }, @@ -619,7 +597,7 @@ "type": "string" }, "degree": { - "default": null, + "default": "PhD", "description": "The type of the degree.", "examples": [ "BS", @@ -647,7 +625,7 @@ "description": "This class is the data model of `ExperienceEntry`.", "properties": { "start_date": { - "default": null, + "default": "2000-01-01", "description": "The start date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format.", "examples": [ "2020-09-24" @@ -667,7 +645,7 @@ ] }, "end_date": { - "default": null, + "default": "2020-01-01", "description": "The end date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format. If the event is still ongoing, then type \"present\" or provide only the start date.", "examples": [ "2020-09-24", @@ -691,7 +669,7 @@ ] }, "date": { - "default": null, + "default": "Custom Date or 2020-01-01", "description": "If the event is a one-day event, then this field should be filled in YYYY-MM-DD format. If the event is a multi-day event, then the start date and end date should be provided instead. All of them can't be provided at the same time.", "examples": [ "2020-09-24", @@ -731,7 +709,7 @@ "default": null, "description": "The location of the event.", "examples": [ - "Istanbul, Turkey" + "Istanbul, T\u00fcrkiye" ], "title": "Location", "allOf": [ @@ -740,27 +718,6 @@ } ] }, - "url": { - "default": null, - "title": "Url", - "allOf": [ - { - "format": "uri", - "maxLength": 2083, - "minLength": 1, - "type": "string" - } - ] - }, - "url_text": { - "default": null, - "title": "Url Text", - "allOf": [ - { - "type": "string" - } - ] - }, "company": { "description": "The company name. It will be shown as bold text.", "title": "Company", @@ -780,6 +737,7 @@ "type": "object" }, "McdowellThemeOptions": { + "additionalProperties": false, "description": "", "properties": { "theme": { @@ -791,10 +749,10 @@ "theme" ], "title": "McdowellThemeOptions", - "type": "object", - "additionalProperties": false + "type": "object" }, "ModerncvThemeOptions": { + "additionalProperties": false, "description": "", "properties": { "theme": { @@ -931,15 +889,14 @@ "theme" ], "title": "ModerncvThemeOptions", - "type": "object", - "additionalProperties": false + "type": "object" }, "NormalEntry": { "additionalProperties": false, "description": "This class is the data model of `NormalEntry`.", "properties": { "start_date": { - "default": null, + "default": "2000-01-01", "description": "The start date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format.", "examples": [ "2020-09-24" @@ -959,7 +916,7 @@ ] }, "end_date": { - "default": null, + "default": "2020-01-01", "description": "The end date of the event in YYYY-MM-DD, YYYY-MM, or YYYY format. If the event is still ongoing, then type \"present\" or provide only the start date.", "examples": [ "2020-09-24", @@ -983,7 +940,7 @@ ] }, "date": { - "default": null, + "default": "Custom Date or 2020-01-01", "description": "If the event is a one-day event, then this field should be filled in YYYY-MM-DD format. If the event is a multi-day event, then the start date and end date should be provided instead. All of them can't be provided at the same time.", "examples": [ "2020-09-24", @@ -1023,7 +980,7 @@ "default": null, "description": "The location of the event.", "examples": [ - "Istanbul, Turkey" + "Istanbul, T\u00fcrkiye" ], "title": "Location", "allOf": [ @@ -1032,27 +989,6 @@ } ] }, - "url": { - "default": null, - "title": "Url", - "allOf": [ - { - "format": "uri", - "maxLength": 2083, - "minLength": 1, - "type": "string" - } - ] - }, - "url_text": { - "default": null, - "title": "Url Text", - "allOf": [ - { - "type": "string" - } - ] - }, "name": { "description": "The name of the entry. It will be shown as bold text.", "title": "Name", @@ -1113,6 +1049,7 @@ "type": "string" }, "date": { + "default": "2020-01-01", "description": "The date of the publication in YYYY-MM-DD, YYYY-MM, or YYYY format.", "examples": [ "2021-10-31",