SG-43936 [Data Model] Add Reference components on publish#1115
SG-43936 [Data Model] Add Reference components on publish#1115carlos-villavicencio-adsk wants to merge 15 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/data-model-base #1115 +/- ##
========================================================
- Coverage 80.41% 80.27% -0.14%
========================================================
Files 203 203
Lines 19549 19680 +131
========================================================
+ Hits 15720 15798 +78
- Misses 3829 3882 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- add new "variantSet" and "source" components to schema config - removed unnecessary calls to ensure_unique_name() when creating asset hierarchy - replace Task folder in asset hierarchy with a root asset which is of type "container" for now - necessary in order for the Asset Viewer to display its children - move generic assets directly under pipeline step in asset hierarchy - added FlowAsset.get_derivatives() function - switched existing derivative workflow to use new "source" component instead of previous temporary component for designating derivative source - use get_schema_id() within ComponentSpecs to avoid needing to pass in type_id parameter for components using custom schemas - added components_action parameter to publish_new_revision() so that user can choose to append components rather than replace them (which is default behaviour) - formatting for schema_builder.py
Properties typed as autodesk.me:reference-2.0.0 are nested schema objects,
not primitives. The server expects {"objectId": {"id": "<urn>"}} rather than
a plain string, matching the autodesk.data:reference-2.0.0 schema structure.
- Add build_reference_value() utility to utils.py to centralize this format
- Fix DerivativeSourceComponentSpec.targetVersion to use build_reference_value()
- Fix VariantSetComponentSpec.targetAsset to use build_reference_value()
…tructure The targetVersion property is typed as autodesk.me:reference-2.0.0, whose objectId field is autodesk.data:identifier-1.0.0 (a nested object with an id field), not a plain string. After fixing the serialization in DerivativeSourceComponentSpec, the RSQL filter path must reflect the new structure: data.targetVersion.objectId.id instead of data.targetVersion. Without this fix, get_derivatives() always returned empty because the old filter path never matched the nested object, causing a new derivative asset to be created on every publish instead of versioning the existing one.
- added get_sources() and get_variant_sets() utilities to ComponentMixin - handle reference properties in FlowComponent so that they're more useable.
…et/SG-43936_add_reference_on_publish
| if dep.dep_type != DepType.ASSET: | ||
| raise FlowError( | ||
| f"Dependency at index {i} has unexpected type " | ||
| f"{dep.dep_type!r}. Only DepType.ASSET deps should be " |
There was a problem hiding this comment.
Typo I think? Is the "!r" supposed to be in this string?
There was a problem hiding this comment.
!r calls repr() on the value instead of str(). For an enum like DepType.LOCAL it produces <DepType.LOCAL: 'local'> rather than just DepType.LOCAL, which gives more context in error messages. What do you think?
There was a problem hiding this comment.
Oh I didn't know that syntax. I guess I usually just say dep.dep_type.name - I think this is clearer?
There was a problem hiding this comment.
Oh actually I think "DepType.LOCAL" is best personally. Of the three options.
There was a problem hiding this comment.
Got it, changed to {dep.dep_type} instead.
yungsiow
left a comment
There was a problem hiding this comment.
Small suggestion, not a big deal. Looks good otherwise!
This pull request introduces support for "reference components" to record asset dependencies in the pipeline. The main changes include updating the schema, adding a new
ReferenceComponentSpecclass, and updating the publish utilities to create reference components when internal asset dependencies are detected.Support for reference components and dependency tracking:
component.referenceschema toconfig.jsonto represent asset dependencies as components.ReferenceComponentSpecclass inpublish.pyto encapsulate creation of reference components, including theirversion_id.create_components_for_publishinutils.pyto accept anint_depsargument and create aReferenceComponentSpecfor each asset-type dependency found in the scene. [1] [2]REFERENCE_TYPEconstant toglobals.pyand imported it where needed. [1] [2] [3]API enhancements for dependency access:
get_references()method toFlowProject(inobjects.py) to retrieve all reference components on an asset or revision.Additionally, the pipeline schema version was bumped to 1.1.0 to reflect these changes.