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

Expanded navigation property is alway null when using drafts

FFeil
Discoverer
0 Kudos
142

Hi,

I have this CDS model.

entity ApiEntities : cuid {
    api  : Association to Apis;
    type : Association to ApiEntityTypes;
}

entity ApiEntityTypes : cuid {
    api         : Association to Apis;
}

entity Apis : cuid {
    apiEntities     : Composition of many ApiEntities
                          on apiEntities.api = $self;
    apiEntityTypes  : Composition of many ApiEntityTypes
                          on apiEntityTypes.api = $self;
}

I added this annotation to enable drafts.

annotate service.Apis with @(odata.draft.enabled);

Then i created all of those entities as drafts.

POST /Apis
{
	"IsActiveEntity": false
}
POST /ApiEntityTypes
{
	"IsActiveEntity": false,
	"api_ID": "1798c58c-a5cf-47f1-a063-61cf5a5dee65"
}
POST /ApiEntities
{
	"IsActiveEntity": false,
	"api_ID": "1798c58c-a5cf-47f1-a063-61cf5a5dee65",
	"type_ID": "5402f265-af8f-4c4f-b04e-af4a68719d7f"
}

Now i want to expand type in ApiEntity but "type" is always null. Is this intended?

GET /ApiEntities?$expand=type
{
	"@context": "$metadata#ApiEntities(type())/$entity",
	"@metadataEtag": "W/\"0a468f163ee40f0e57c70e0ef1a9501919bd6af288e112a6bbe498346e97f613\"",
	"ID": "447dfabf-2ace-438a-bb11-2dcd47bab912",
	"api_ID": "1798c58c-a5cf-47f1-a063-61cf5a5dee65",
	"type_ID": "5402f265-af8f-4c4f-b04e-af4a68719d7f",
	"IsActiveEntity": false,
	"HasActiveEntity": false,
	"HasDraftEntity": false,
	"type": null,
	"DraftAdministrativeData": {
		"DraftUUID": "38ff890b-467c-436e-a8af-1de522705c1d",
		"CreationDateTime": null,
		"CreatedByUser": null,
		"DraftIsCreatedByMe": null,
		"LastChangeDateTime": null,
		"LastChangedByUser": null,
		"InProcessByUser": null,
		"DraftIsProcessedByMe": null
	}
}

If I activate this draft Apis object and call /ApiEntities?$expand=type again, then expand works.

 

Accepted Solutions (0)

Answers (0)