8000 Fix broken database relation request parameters. by gehongyan · Pull Request #404 · notion-dotnet/notion-sdk-net · GitHub
[go: up one dir, main page]

Skip to content

Fix broken database relation request parameters. #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 12, 2025

Conversation

gehongyan
Copy link
Contributor

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

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

@gehongyan
Copy link
Contributor Author
gehongyan commented Nov 8, 2023

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

@KoditkarVedant
Copy link
Contributor

@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.

@gehongyan
Copy link
Contributor Author
gehongyan commented Feb 22, 2025

@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

@KoditkarVedant KoditkarVedant requested a review from Copilot April 12, 2025 11:11
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

Test/Notion.IntegrationTests/DatabasesClientTests.cs:46

  • [nitpick] Consider renaming the test method to more clearly reflect the expected outcome (e.g., 'UpdateDatabaseRelationProperties_ShouldUpdateRelationSchema') to improve clarity.
[Fact] public async Task UpdateDatabaseRelationProperties()

@KoditkarVedant KoditkarVedant merged commit 6615bf7 into notion-dotnet:main Apr 12, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RelationPropertySchema and RelationUpdatePropertySchema are broken.
2 participants
0