-
Notifications
You must be signed in to change notification settings - Fork 50
Body failed validation when trying to update two properties at once #345
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
Comments
Trying to erase property:When passing
When passing
When passing
|
Trying to update property.Initially, I am able to successfully fill empty Text property with code: RichTextPropertyValue result = new()
{
RichText = new List<RichTextBase>()
};
Text text = new() { Content = content };
RichTextText item = new() { Text = text };
result.RichText.Add(item);
return result; But If this property already have some value, I see:
|
Okay, so my experiments show that it is something with multiple properties at nose. This works: public async Task TestAsync(string pageId)
{
await TestUpdate(pageId, null, "https://github.com");
await TestUpdate(pageId, "text 1", null);
await TestUpdate(pageId, null, "https://github.com");
await TestUpdate(pageId, "text 2", null);
await TestUpdate(pageId, null, "https://github.com");
}
private async Task TestUpdate(string pageId, string? text, string? url)
{
Dictionary<string, PropertyValue?> properties = new()
{
{ "Text", CreateTextValue(text) },
};
await _client.Pages.UpdatePropertiesAsync(pageId, properties);
properties = new Dictionary<string, PropertyValue?>
{
{ "URL", url is null ? null : new UrlPropertyValue { Url = url } }
};
await _client.Pages.UpdatePropertiesAsync(pageId, properties);
} and this produces errors for some reason: public async Task TestAsync(string pageId)
{
await TestUpdate(pageId, null, "https://github.com");
await TestUpdate(pageId, "text 1", null);
await TestUpdate(pageId, null, "https://github.com");
await TestUpdate(pageId, "text 2", null);
await TestUpdate(pageId, null, "https://github.com");
}
private async Task TestUpdate(string pageId, string? text, string? url)
{
Dictionary<string, PropertyValue?> properties = new()
{
{ "Text", CreateTextValue(text) },
{ "URL", url is null ? null : new UrlPropertyValue { Url = url } }
};
await _client.Pages.UpdatePropertiesAsync(pageId, properties);
} |
@Vadim-Borovikov I tried to reproduce this but it seems the problem is with the Notion API. I verified this by directly using Postman. May be you could report this at https://github.com/makenotion/notion-sdk-js |
Describe the bug
Pages.UpdatePropertiesAsync fails when non-empty Text property gets updated.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Properties get updated, no errors from API.
The text was updated successfully, but these errors were encountered: