Skip to content
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
merged 14 commits into from
Sep 28, 2023

Conversation

alvarobartt
Copy link
Member

@alvarobartt alvarobartt commented Sep 27, 2023

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 the FeedbackRecord schema not to include the fields with value None.

Closes #3845

Type of change

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

How Has This Been Tested

  • Add unit tests for FeedbackRecord.to_server_payload with required=False fields
  • Add unit tests for the validation on the API-side when creating records via validate_record_fields

Checklist

  • 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
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@alvarobartt alvarobartt marked this pull request as ready for review September 27, 2023 18:56
@alvarobartt alvarobartt self-assigned this Sep 27, 2023
@alvarobartt alvarobartt added area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints bugfix labels Sep 27, 2023
@alvarobartt alvarobartt added this to the v1.17.0 milestone Sep 27, 2023
@alvarobartt alvarobartt merged commit 92392c4 into develop Sep 28, 2023
@alvarobartt alvarobartt deleted the fix/optional-record-fields branch September 28, 2023 13:22
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]>
@frascuchon frascuchon modified the milestones: v1.17.0, v1.18.0 Oct 19, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Optional fields raised exception when not passed to the server
3 participants