Skip to content

SG-43936 [Data Model] Add Reference components on publish#1115

Open
carlos-villavicencio-adsk wants to merge 15 commits into
feat/data-model-basefrom
ticket/SG-43936_add_reference_on_publish
Open

SG-43936 [Data Model] Add Reference components on publish#1115
carlos-villavicencio-adsk wants to merge 15 commits into
feat/data-model-basefrom
ticket/SG-43936_add_reference_on_publish

Conversation

@carlos-villavicencio-adsk

@carlos-villavicencio-adsk carlos-villavicencio-adsk commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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 ReferenceComponentSpec class, and updating the publish utilities to create reference components when internal asset dependencies are detected.

Support for reference components and dependency tracking:

  • Added a new component.reference schema to config.json to represent asset dependencies as components.
  • Introduced the ReferenceComponentSpec class in publish.py to encapsulate creation of reference components, including their version_id.
  • Updated create_components_for_publish in utils.py to accept an int_deps argument and create a ReferenceComponentSpec for each asset-type dependency found in the scene. [1] [2]
  • Added the REFERENCE_TYPE constant to globals.py and imported it where needed. [1] [2] [3]

API enhancements for dependency access:

  • Added a get_references() method to FlowProject (in objects.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.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.27%. Comparing base (44bbb90) to head (fdc566c).

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     
Flag Coverage Δ
Linux 79.71% <ø> (+0.13%) ⬆️
Python-3.10 80.09% <ø> (+0.16%) ⬆️
Python-3.11 79.98% <ø> (+0.16%) ⬆️
Python-3.13 79.98% <ø> (-0.17%) ⬇️
Python-3.9 80.05% <ø> (+0.16%) ⬆️
Windows 79.74% <ø> (+0.17%) ⬆️
macOS 79.72% <ø> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

yungsiow and others added 7 commits July 9, 2026 17:26
- 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.
@carlos-villavicencio-adsk
carlos-villavicencio-adsk changed the base branch from master to ticket/sg-43935/data-model-derivative-update July 15, 2026 15:59
Base automatically changed from ticket/sg-43935/data-model-derivative-update to feat/data-model-base July 15, 2026 18:07
@carlos-villavicencio-adsk
carlos-villavicencio-adsk marked this pull request as ready for review July 16, 2026 15:08
Comment thread python/tank/flowam/config.json Outdated
Comment thread python/tank/flowam/config.json Outdated
Comment thread python/tank/flowam/utils.py Outdated
Comment thread python/tank/flowam/utils.py Outdated
Comment thread python/tank/flowam/utils.py Outdated
Comment thread python/tank/flowam/utils.py Outdated
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 "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo I think? Is the "!r" supposed to be in this string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't know that syntax. I guess I usually just say dep.dep_type.name - I think this is clearer?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually I think "DepType.LOCAL" is best personally. Of the three options.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, changed to {dep.dep_type} instead.

Comment thread python/tank/flowam/utils.py Outdated
Comment thread python/tank_vendor/flow_integration_sdk/objects.py Outdated
Comment thread python/tank_vendor/flow_integration_sdk/objects.py Outdated
Comment thread python/tank_vendor/flow_integration_sdk/publish.py Outdated

@yungsiow yungsiow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small suggestion, not a big deal. Looks good otherwise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants