Skip to content

Fix allowing sorting Contract Definitions by creation date #4921

@bmg13

Description

@bmg13

Bug Report

Describe the Bug

Enable retrieving Contract Definitions sorted by their creation date.

Expected Behavior

We should be able to sort Contract Definitions by their creation date, similar to what is seen with other entities (like assets and policies).

Observed Behavior

Currently is not possible to sort Contract Definitions based on their creation time.

Steps to Reproduce

Perform the GET Contract Definitions request

/v3/contractdefinitions/request

With a sorting order defined in the body, like

{
 "@context": {},
 "@type": "QuerySpecDto",
 "https://w3id.org/edc/v0.0.1/ns/offset": 0,
 "https://w3id.org/edc/v0.0.1/ns/limit": 50,
 "sortField": "createdAt",
 "sortOrder": "DESC"
}

It will return a 5XX.

Context Information

Keep in mind that workaround to use the createdAt value from response is not possible at the meantime since this value is not in the response, as explained here.

Possible Implementation

add the creation date mapping in here like so

add("createdAt", statements.getCreatedAtColumn());

similar to what is seen in other Entities, like Assets.

Further notes

This issue was created as a bug since this may not be intended behavior. If is intended, we could propose changing the 5XX http status response to a 4XX.

Detailed Description

The following are additional elements to show that storing in the db is working as expected and may help explain the proposed fix as well.

Image

Image

Metadata

Metadata

Assignees

Labels

bug_reportSuspected bugs, awaiting triagestaleOpen for x days with no activity

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions