Name the check fields qualityId and failedSamples - #1486
Merged
Conversation
The test-results model spells every other field in camelCase (runId, dataContractId, timestampStart), so the two check fields that carried the Python attribute name now do too. The old names stay available: they are accepted as input (keyword arguments and test results serialized by an older version), still read and write on the Check model with a DeprecationWarning, and are still written next to the new ones, so a consumer of /api/test-results keeps working. An unset field is not serialized under either name.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The test-results model spells every other field in camelCase (
runId,dataContractId,timestampStart), so the twoCheckfields that carried the Python attribute name now do too:quality_id->qualityId,failed_samples->failedSamples.Backward compatibility
The old names stay available in every direction, so nothing that reads or writes them breaks:
check.failed_samples(read)failedSamples,DeprecationWarningcheck.failed_samples = rows(write)failedSamples,DeprecationWarningCheck(quality_id="r")qualityIdCheck.model_validate({"quality_id": "r"})qualityIdThe write path needs the property setter specifically: without it pydantic rejects assignment to an unknown attribute, and
check.failed_samples = sampleswas the common usage.Serialization writes both spellings so a consumer of
/api/test-resultskeeps working:{ "qualityId": "orders_not_empty", "failedSamples": [{"id": 1}], "quality_id": "orders_not_empty", "failed_samples": [{"id": 1}] }Only set values are duplicated, so an unset field stays absent under the old name even in a full dump that keeps nulls, and a run with no quality rules grows by nothing. Serializing reads the field rather than the deprecated property, so publishing a run emits no
DeprecationWarning.Tests
tests/test_run_check_deprecated_fields.pycovers each row of the table plus the unset case. The suite was also run with-W error::DeprecationWarning: no code path inside the CLI uses the old names.🤖 Generated with Claude Code