cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Recursive CDS data type

former_member748892
Discoverer
0 Likes
2,539

Dear colleagues,

I'm trying to create a recursive data type using SAP CDS version 5.0.6. So far I experimented with the following:

type Node { value: String; children: many Node; }

This yields an error: 'Illegal circular reference'. Do you know how can this use case modelled in CDS?

Thanks,

Daniel

View Entire Topic

Recursive type are indeed not supported in CDS. Before we would invest in this direction, we would have to check whether they would be supported in consumers of CDS models.

In SQL, it would be fine in combination with MANY (like your example), because then it would be mapped to a CLOB... In OData and OData consumers...

In CDS, you have recursive data structures via Associations/compositions

entity Node {
  key id: UUID;
  value: String;
  children: Composition of Node;
}

Regards,
Christoph