feat(entity.py): {etype}/get sorting#41
Open
softlukas wants to merge 1 commit into
Open
Conversation
d19d81a to
5ac5329
Compare
xsedla1o
requested changes
Jun 4, 2026
Collaborator
xsedla1o
left a comment
There was a problem hiding this comment.
Looks good for the most part, minor issues in comments bellow.
| ) | ||
|
|
||
| data_type_str = str(attr_spec.data_type) | ||
| allowed_primitives = set(primitive_data_types.keys()) - {"json"} |
Collaborator
There was a problem hiding this comment.
There is a "special" type in primitive_data_types, which should be excluded as well.
|
|
||
| def _validate_sort_params( | ||
| etype: str, sort_by: str | None, sort_order: int | None | ||
| ) -> tuple[str | None, int]: |
Collaborator
There was a problem hiding this comment.
I'm not a fan of tuple[str | None, int] as a return type, because that means you have to unpack the tuple correctly and then check for None to see if any sorting is actually hapenning. As it stands now, the returned sort_order value must also be ignored in the no sort case, because it is never validated.
It would make more sense to me to return tuple[str, int] | None, where you can just check for None straight away and there is no mixed invalid state.
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.
sorting implementation
entity/{etype}/getin dp3 api, please check if all conditions which raise exeption is correct, or if some check not missing