-
Notifications
You must be signed in to change notification settings - Fork 68
AL-2183 - Add MediaType support to Project #555
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
Merged
Merged
Conversation
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
jtsodapop
approved these changes
Apr 28, 2022
Contributor
jtsodapop
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, minor nits
msokoloff1
reviewed
Apr 29, 2022
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
msokoloff1
reviewed
May 3, 2022
msokoloff1
approved these changes
May 3, 2022
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.
This is the implementation of https://labelbox.atlassian.net/browse/AL-2183 to create, retrieve and update media types for projects.
To highlight that
MediaTypeis generic and not specific to projects, the enumeration was relocated to its own filemedia_type.py.Terminology
We use the terminology
MediaTypeandmedia_typeto match the GraphQL type and make it easier to use compared toallowedMediaTypefound in theProjecttable.Implementation of the MediaType enumeration
The names in the
MediaTypeenumeration use title case. This matches the convention of the existingQueueModeenumeration in theProjectclass. With that said, the enumeration also supports upper case names for compatibility with the GraphQL type.To support the case when
media_typeis not set for the project, ifMediaTypeis called forNonethen it returnsMediaType.Unknown.In order to match the UI, a few aliases were added compared to the GraphQL
MediaTypetype:Otherwise, the enumeration matches the GraphQL type (including Unsupported for future usage).
Case of MediaType.Unknown
Although the member
MediaType.UNKOWNexists in GraphQL, it is not a supported value. Since using it would lead to a HTTP 500 (internal server error) error, this value is filtered for bothclient.create_project()andProject.update().Side modification
The file
labelbox/orm/db_object.pyis slightly modified to support the case where data_type is not set (aka value is None).