notion-sdk-net icon indicating copy to clipboard operation
notion-sdk-net copied to clipboard

Fix broken database relation request parameters.

Open gehongyan opened this issue 2 years ago • 2 comments

Description

The database relation request parameters are broken.

In Notion API version 2022-06-28, database relations would have a type of single_property and dual_property.

The type of Relation property of RelationProperty was updated, but that of RelationPropertySchema and RelationUpdatePropertySchema were missed.

Fixes #403

Related Notion changelog: https://developers.notion.com/page/changelog#database-relations-have-a-type-of-single_property-and-dual_property

How Has This Been Tested?

I published the package locally and installed it in my projects. The use case is updated as:

await notionClient.Databases.UpdateAsync(createdDatabase.Id, new DatabasesUpdateParameters
{
    Properties = new Dictionary<string, IUpdatePropertySchema>
    {
        ["Conflicted"] = new RelationUpdatePropertySchema
        {
            Relation = new SinglePropertyRelation()
            {
                SingleProperty = new Dictionary<string, object>(),
                DatabaseId = createdDatabase.Id
            }
        }
    }
});

My code tries to update a database schema to add a new self-referencing column, which works well now.

Type of change

  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

gehongyan avatar Nov 08 '23 10:11 gehongyan

By the way, I am not sure why the Notion API still describes the Relation as unchanged.

https://developers.notion.com/reference/property-object#relation

gehongyan avatar Nov 08 '23 10:11 gehongyan

@gehongyan Not sure if the document out of sync with changes by Notion. By the way would you be able to add the Integration test for this change? I don't run them as part of workflow but are useful locally to verify.

KoditkarVedant avatar Nov 14 '23 18:11 KoditkarVedant

@gehongyan Not sure if the document out of sync with changes by Notion. By the way would you be able to add the Integration test for this change? I don't run them as part of workflow but are useful locally to verify.

Hi, @KoditkarVedant. A new test for creating database relation properties has been appended.


image

image

gehongyan avatar Feb 22 '25 03:02 gehongyan