Bi-directional references?

Hi,

just getting started with Squidex and really like it so far. From a user perspective as well related to the implementation choices.

Currently, it’s a bit unclear to me how references are handled. Seems that the reference is only available in one direction.

As an example: I have SchemaA with a reference to SchemaB. If I request SchemaA through the API I see SchemaB linked. But if I request SchemaB I have no reference to SchemaA.

It this by design or am I missing something?

Yes, this is by design. Squidex is more like a document oriented database and not like a relational database where relationships are designed bidirectional. This has some advantages and of course some disadvantages.

For developers: I tend to design my domain objects as aggregates / aggregate roots: https://martinfowler.com/bliki/DDD_Aggregate.html

Ok. I see. So getting the SchemaA references from SchemaB would be done by actively querying something like

https://cloud.squidex.io/api/content/my-project/schema-a?$filter=data/schema-b/iv eq 'e3f9c490-bed4-446f-9def-6cc81d101a46'

This would give me all SchemaA that are refrenced by SchemaB. Just to confirm if this is the way to use the API.

Exactly and of course you can also pull in the referenced contents with graphql.

1 Like