-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow required=False
fields to be logged in Argilla
#3846
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frascuchon
reviewed
Sep 27, 2023
frascuchon
reviewed
Sep 27, 2023
frascuchon
reviewed
Sep 27, 2023
alvarobartt
commented
Sep 28, 2023
Co-authored-by: Francisco Aranda <[email protected]>
gabrielmbmb
approved these changes
Sep 28, 2023
Co-authored-by: Gabriel Martín Blázquez <[email protected]>
frascuchon
approved these changes
Sep 28, 2023
alvarobartt
added a commit
that referenced
this pull request
Sep 28, 2023
This PR addresses an issue with the Argilla API, since it's not handling optional values passed as e.g. `{"required": "text", "optional_value": None}` neither when those optional fields are not provided as part of the payload e.g. `{"required": "text"}`. So on, in the PR the API validation when creating new records has been fixed to check that the optional fields are neither None nor str, instead of applying the same check as for the required fields; plus improving the `to_server_payload` method in the `FeedbackRecord` schema not to include the fields with value None. Closes #3845 **Type of change** - [X] Bug fix (non-breaking change which fixes an issue) **How Has This Been Tested** - [x] Add unit tests for `FeedbackRecord.to_server_payload` with `required=False` fields - [X] Add unit tests for the validation on the API-side when creating records via `validate_record_fields` **Checklist** - [ ] I added relevant documentation - [X] follows the style guidelines of this project - [X] I did a self-review of my code - [ ] I made corresponding changes to the documentation - [X] My changes generate no new warnings - [X] I have added tests that prove my fix is effective or that my feature works - [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK) (see text above) - [X] I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/) --------- Co-authored-by: Francisco Aranda <[email protected]> Co-authored-by: Gabriel Martín Blázquez <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: api
Indicates that an issue or pull request is related to the Fast API server or REST endpoints
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses an issue with the Argilla API, since it's not handling optional values passed as e.g.
{"required": "text", "optional_value": None}
neither when those optional fields are not provided as part of the payload e.g.{"required": "text"}
.So on, in the PR the API validation when creating new records has been fixed to check that the optional fields are neither None nor str, instead of applying the same check as for the required fields; plus improving the
to_server_payload
method in theFeedbackRecord
schema not to include the fields with value None.Closes #3845
Type of change
How Has This Been Tested
FeedbackRecord.to_server_payload
withrequired=False
fieldsvalidate_record_fields
Checklist