Skip to content

Commit

Permalink
[BUGFIX] remove name as default description in settings models (#5081)
Browse files Browse the repository at this point in the history
This change adapt the base settings model so that name is not used as a
default description for questions.

- Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- follows the style guidelines of this project
- I did a self-review of my code
- I made corresponding changes to the documentation
- I confirm My changes generate no new warnings
- I have added tests that prove my fix is effective or that my feature
works
- I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

Co-authored-by: Ben Burtenshaw <[email protected]>
  • Loading branch information
burtenshaw and burtenshaw authored Jun 28, 2024
1 parent c6df634 commit 1ec0feb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions argilla/src/argilla/_models/_settings/_questions/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class QuestionBaseModel(BaseModel, validate_assignment=True):
settings: QuestionSettings

title: str = Field(None, validate_default=True)
description: Optional[str] = Field(None, validate_default=True)
description: Optional[str] = None
required: bool = True
inserted_at: Optional[datetime] = None
updated_at: Optional[datetime] = None
Expand All @@ -47,12 +47,6 @@ def __title_default(cls, title, info: ValidationInfo):
validated_title = title or info.data["name"]
return validated_title

@field_validator("description")
@classmethod
def __description_default(cls, description, info: ValidationInfo) -> Optional[str]:
data = info.data
return description or data["title"]

@field_serializer("inserted_at", "updated_at", when_used="unless-none")
def serialize_datetime(self, value: datetime) -> str:
return value.isoformat()
Expand Down

0 comments on commit 1ec0feb

Please sign in to comment.