You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add more contextual information to entity version objects to navigate historical data more effectively.
Implementation
Add the following fields to the EntityVersion GraphQL object:
typeEntityVersion {
# Version idid: String! # (NEW) Timestamp of when the edit was proposed (optional since doesn't apply to personal spaces and space imports)proposedAt: String,
# (NEW) Block number of when the edit was proposedproposedAtBlock: String,
# (NEW) Timestamp of when the edit was published/executed (null if still a proposal)publishedAt: String # (NEW) Block number of when the edit was proposedpublishedAtBlock: String # (NEW) Author of the proposal for the editauthor: String! # (NEW) List of attributes changed as part of the editupdatedAttributes: [Triple!]! # (NEW) Name of the entity at the time of the editname: String # (NEW) Description of the entity at the time of the editdescription: String # (NEW) Cover of the entity at the time of the editcover: String # (NEW) Types of the entity at the time of the edittypes: [Entity!]! # (NEW) Blocks of the entity at the time of the editblocks: [Entity!]! # Entity attributes as of this versionattributes(filter: AttributeFilter): [Triple!]!
}
Alternatives
Since the EntityVersion object is getting quite complex (having both fields related to the version as well as all other entity fields), it might be worth refactoring the API and separating those.
Here would be an alternative design
typeQuery {
# (NEW) Fetch all versions for an entityentityVersions(entityId: String): [EntityVersion!]!
}
typeEntityVersion {
# Version idid: String! # (NEW) Timestamp of when the edit was proposed (optional since doesn't apply to personal spaces and space imports)proposedAt: String,
# (NEW) Block number of when the edit was proposedproposedAtBlock: String,
# (NEW) Timestamp of when the edit was published/executed (null if still a proposal)publishedAt: String # (NEW) Block number of when the edit was proposedpublishedAtBlock: String # (NEW) Author of the proposal for the editauthor: String! # (NEW) List of attributes changed as part of the editupdatedAttributes: [Triple!]! # (NEW) Relation to the entity at the time of the editentity: Entity!
}
typeEntity {
# (REMOVE) # versions: [EntityVersion!]! # (NEW) Version of the selected entityversion: EntityVersion!
...
}
With this design, the query to get multiple versions of an entity would look like this:
Moreover, since versions are not really bound to entities, but rather to edits, it might make sense to change the naming of EntityVersion to EntityEdit, Edit or something along those lines.
The text was updated successfully, but these errors were encountered:
cvauclair
changed the title
Add version filter to GraphQL API
feat(api): Add additional fields to EntityVersion GraphQL object
Feb 21, 2025
Motivation
Add more contextual information to entity version objects to navigate historical data more effectively.
Implementation
Add the following fields to the
EntityVersion
GraphQL object:Alternatives
Since the
EntityVersion
object is getting quite complex (having both fields related to the version as well as all other entity fields), it might be worth refactoring the API and separating those.Here would be an alternative design
With this design, the query to get multiple versions of an entity would look like this:
Instead of
Moreover, since versions are not really bound to entities, but rather to edits, it might make sense to change the naming of
EntityVersion
toEntityEdit
,Edit
or something along those lines.The text was updated successfully, but these errors were encountered: