Skip to content

Commit 0a867de

Browse files
committed
[Traits] Add versioning traits/specifications
Adds traits and specifications that can be used to replicate the old "versioning" API methods from the core API. These were recently removed in favour of domain specific definitions such as these. We opted to add base traits for 'usage' to the package. These should be composed with the other relevant traits when defining a specification to allow runtime introspection of the trait set. Amongst other uses, this helps managers in their implementation of methods such as `managementPolicy` where they need to be able to determine the nature of the query. For relationships, this also adds traits that define the expected cardinality of the result references. This helps inform a host whether they should be using the paged API methods. Part of OpenAssetIO#48 Signed-off-by: Tom Cowland <[email protected]>
1 parent d1eebfe commit 0a867de

File tree

2 files changed

+185
-1
lines changed

2 files changed

+185
-1
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ v1.0.0-alpha.x
1111
Added cmake variables `OPENASSETIO_MEDIACREATION_GENERATE_PYTHON` and
1212
`OPENASSETIO_MEDIACREATION_PYTHON_SITEDIR` to support this.
1313

14+
- Added traits and specifications to define and query entity versioning
15+
information.
16+
[#48](https://github.com/OpenAssetIO/OpenAssetIO-MediaCreation/issues/48)
17+
1418
v1.0.0-alpha.6
1519
--------------
1620

traits.yml

Lines changed: 181 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@ package: openassetio-mediacreation
44
description: Well-known Traits and Specifications for use in OpenAssetIO
55
hosts and managers.
66
traits:
7+
usage:
8+
description: >
9+
Base traits that scope a trait set for use within a specific
10+
context, such as resolution or relationship queries. Exactly
11+
one of these should be included in any given Specification.
12+
members:
13+
Entity:
14+
description: The trait set defines qualities of an entity.
15+
usage:
16+
- entity
17+
Relationship:
18+
description: >
19+
The trait set defines a relationship between one or more
20+
entities.
21+
usage:
22+
- relationship
723
content:
824
description: Traits related to abstract content.
925
members:
@@ -24,7 +40,7 @@ traits:
2440
location:
2541
type: string
2642
description: >
27-
The location of the entities external content.
43+
The location of the entity's external content.
2844
2945
3046
This must be a valid URL, so special characters need to
@@ -68,6 +84,98 @@ traits:
6884
of an asset in an 'open recent' menu.
6985
- `"Sequence 003 [ Dive / Episode 1 ]"` for a sequence in
7086
a hierarchy as a window title.
87+
lifecycle:
88+
description: >
89+
Traits that are concerned with describing aspects of the lifecycle
90+
of an entity, such as versioning.
91+
members:
92+
Version:
93+
description: >
94+
Describes a specific version of an entity.
95+
96+
97+
A version is defined as a revision or iteration of what is
98+
otherwise the same logical entity. If supported by a manager,
99+
versions are created when new data is published to an existing
100+
entity. Not all managers may version all types of entity.
101+
102+
103+
There is no requirement for version to be a singular atomic
104+
series, managers may wish to support "meta versions", such as
105+
'vLatest' or similar, or provide multiple parallel versioning
106+
streams.
107+
108+
109+
This trait can be used in several places:
110+
- When resolved, the manager should provide information about
111+
the version of the referenced entity. This trait should only
112+
be imbued if the target entity is considered versioned by the
113+
manager, and it can populate the stableTag property.
114+
- When responding to managementPolicy for an entity trait set,
115+
the manager should imbue this trait if that type of entity
116+
is version managed by the manager (not all managers version
117+
all types of entity).
118+
- When used within a relationship query, this trait indicates
119+
that the returned entities should be constrained to other
120+
versions of the logical entity targeted by the reference.
121+
usage:
122+
- entity
123+
- relationship
124+
- managementPolicy
125+
properties:
126+
specifiedTag:
127+
type: string
128+
description: >
129+
An unambiguous identifier (tag) for the specific version of
130+
an entity targeted by a specific reference.
131+
132+
133+
Examples of version tags include "1", "v2", "latest".
134+
135+
136+
If the reference itself does not contain a version
137+
specifier and relies on dynamic behaviour, then this should
138+
be left empty.
139+
stableTag:
140+
type: string
141+
description: >
142+
The tag (see 'specifiedTag') targeted by the reference once
143+
meta-versions or other dynamic behaviour is applied.
144+
145+
146+
If, for example, references without an explicit version
147+
yield the most recent, then this should be set to
148+
the tag of that version. When referencing some other
149+
semantic state (eg. approval), this should be set to the
150+
tag of the concrete version that matches the specific
151+
state.
152+
153+
154+
Examples of stable version tags include "1", "v2".
155+
156+
157+
This property should always be set when the Version trait
158+
is imbued as part of a resolve response. If the entity is
159+
not versioned, then the trait itself should not be imbued.
160+
Stable:
161+
description: >
162+
Defines that the entity references returned from a
163+
relationship query with this trait should be devoid of any
164+
dynamic behaviour. This includes concepts such as
165+
meta-versioning or context-specific variation that results
166+
logically different data being supplied.
167+
168+
169+
This is generally used to snapshot/bookmark specific
170+
configurations to avoid temporal instability and/or ensure
171+
processes are repeatable.
172+
173+
174+
Note: This does not include variations such as regional
175+
adaptation of the LocatableContent trait, where the underlying
176+
data remains the same.
177+
usage:
178+
- relationship
71179
managementPolicy:
72180
description: Traits used in a Manager's managementPolicy response.
73181
members:
@@ -129,6 +237,23 @@ traits:
129237
determine a suitable output location.
130238
usage:
131239
- managementPolicy
240+
relationship:
241+
description: Traits specific to qualities of a relationship.
242+
members:
243+
Singular:
244+
description: >
245+
The relationship should return at most one reference for each
246+
input. Unless otherwise qualified, relationships are
247+
considered one-to-many.
248+
usage:
249+
- relationship
250+
Unbounded:
251+
description: >
252+
The relationship may return large numbers of results for each
253+
input, and so must be used with the paged API methods, such as
254+
Manager.getWithRelationshipPaged.
255+
usage:
256+
- relationship
132257
auth:
133258
description: Traits related to authentication and authorization.
134259
members:
@@ -143,3 +268,58 @@ traits:
143268
type: string
144269
description: >
145270
Contents of the token.
271+
specifications:
272+
lifecycle:
273+
description:
274+
Specifications that are concerned with describing aspects of the
275+
lifecycle of an entity, such as versioning.
276+
members:
277+
EntityVersionsRelationship:
278+
description: >
279+
A relationship between alternate versions of the same logical
280+
entity. This may include unstable versions such as "latest".
281+
traitSet:
282+
- namespace: usage
283+
name: Relationship
284+
- namespace: relationship
285+
name: Unbounded
286+
- namespace: lifecycle
287+
name: Version
288+
usage:
289+
- relationship
290+
StableEntityVersionsRelationship:
291+
description: >
292+
Retrieves references to alternate stable versions of the same
293+
logical entity. This will not include unstable versions such
294+
as "latest".
295+
traitSet:
296+
- namespace: usage
297+
name: Relationship
298+
- namespace: relationship
299+
name: Unbounded
300+
- namespace: lifecycle
301+
name: Version
302+
- namespace: lifecycle
303+
name: Stable
304+
usage:
305+
- relationship
306+
StableReferenceRelationship:
307+
description: >
308+
Retrieves a stable reference to the supplied entity that is
309+
guaranteed to always point to that specific entity and version.
310+
311+
312+
This will apply and remove any dynamic behaviour such as
313+
"latest version" or other context-sensitive behaviour. The
314+
result may be used as a persistent bookmark (such as in an
315+
"open recent" menu), or to snapshot the specific entities used
316+
by a process for archival.
317+
traitSet:
318+
- namespace: usage
319+
name: Relationship
320+
- namespace: relationship
321+
name: Singular
322+
- namespace: lifecycle
323+
name: Stable
324+
usage:
325+
- relationship

0 commit comments

Comments
 (0)