-
Notifications
You must be signed in to change notification settings - Fork 11
🏛️Product base types: add support for product base types in API #255
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for product base types across the API, including new type definitions, query filters, and API operations.
- Introduces ProductBaseTypeDict and default fields for product base types.
- Updates API functions to support filtering, querying, and creating/updating products with the new product base type.
- Extends GraphQL queries and entity hub operations to incorporate product base types.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
ayon_api/typing.py | Added a new TypedDict for product base types. |
ayon_api/server_api.py | Extended product-related functions to support product base types. |
ayon_api/operations.py | Updated product entity creation and update operations to include base type; noted a naming typo. |
ayon_api/graphql_queries.py | Added GraphQL queries for product base types. |
ayon_api/entity_hub.py | Modified product entity handling to incorporate product base type with a documentation update. |
ayon_api/constants.py | Added default fields for product base types. |
ayon_api/_api.py | Updated API functions to include product base type filters. |
ayon_api/init.py | Re-exported new functions related to product base types. |
Comments suppressed due to low confidence (2)
ayon_api/operations.py:117
- Correct the misspelled parameter name from 'produc_base_type' to 'product_base_type' to ensure consistency with the documentation and usage.
produc_base_type: str,
ayon_api/entity_hub.py:447
- Update the docstring to reflect that the function creates a product entity rather than a task object for clarity.
'''Create a task object and add it to the entity hub.
|
||
return parsed_data.get("productBaseTypes", []) | ||
|
||
|
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.
ayon_api/server_api.py
Outdated
return parsed_data.get("project", {}).get("productBaseTypes", []) | ||
|
||
|
||
def get_product_base_type_names( |
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.
This function probably does not have to be implemented in server api.
It does 2 different things, either returns what get_project_product_base_types
does or what get_products
does. Looks like a helper functions somewhere in pipeline, but even there I can't imagine the usecase. I would not include it here.
name: str | ||
color: Optional[str] | ||
icon: Optional[str] | ||
|
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.
@@ -3475,6 +3501,7 @@ def from_entity_data(cls, product, entity_hub): | |||
return cls( | |||
name=product["name"], | |||
product_type=product["productType"], | |||
product_base_type=product["productBaseType"], |
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.
product_base_type=product["productBaseType"], | |
product_base_type=product.get("productBaseType"), |
@@ -3492,6 +3519,7 @@ def to_create_body_data(self): | |||
output = { | |||
"name": self.name, | |||
"productType": self.product_type, | |||
"productBaseType": self.product_base_type, |
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.
This key should be added only if product base type is supported on server.
@@ -143,6 +165,30 @@ def project_product_types_query(fields): | |||
return query | |||
|
|||
|
|||
def project_product_base_types_query(fields): |
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.
I really don't think this should have separate query, it should be added to project query and it does not need special method (meaning get_project_product_base_types
).
product under folder. | ||
name (str): Is considered as a unique identifier of | ||
the product under the folder. | ||
product_base_type (str): Base type of the product, e.g. "render", |
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.
Wrong position of argument
|
||
Args: | ||
project_name (str): Project name. | ||
name (str): Product name. | ||
product_type (str): Product type. | ||
product_base_type (str): Base type of the product, e.g. "render", |
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.
Wrong position of argument.
if value is not None: | ||
update_data[key] = value | ||
|
||
update_data = { |
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.
We should check if product type is supported and raise an error if is passed and is not supported?
@@ -443,10 +444,11 @@ def add_new_product( | |||
entity_id: Optional[str] = None, | |||
created: Optional[bool] = True, | |||
): | |||
"""Create task object and add it to entity hub. | |||
"""Create a task object and add it to the entity hub. |
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.
"""Create a task object and add it to the entity hub. | |
"""Create a product object and add it to the entity hub. |
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.
ServerAPI should have property to check if product base type is supported and that property should be checked if is productBaseType is used for filtering or entity create/update.
Changelog Description
Adding support for product base types.
Additional review information
Once the product base types are established, they should be marked mandatory in function arguments and
product_type
optional.Testing notes:
This shouldn't affect "normal" functionality. If product base type is provided, it should be successfully queried or written to/from server.
Note
Closes: #254
Requires: ynput/ayon-backend#615