8000 Cannot insert page with Select property · Issue #178 · notion-dotnet/notion-sdk-net · GitHub
[go: up one dir, main page]

Skip to content
Cannot insert page with Select property #178
Closed
@hognevevle

Description

@hognevevle

Describe the bug

Trying to create a page with a Select property causes the following error:

Notion.Client.NotionApiException: body failed validation. Fix one: body.properties.Status.select.color should be `"default"`, `"gray"`, `"brown"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"purple"`, `"pink"`, `"red"`, or `undefined`, instead was `"Unknown"`. body.properties.Status.select.name should be defined, instead was `undefined`.

The SelectPropertyValue is created with a SelectOption with just the Id field specified, like this;

new SelectPropertyValue
{
    Select = new SelectOption
    {
        Id = value.ToString()
    }
}

The default value of the Color enum is Unknown. For Color.Unknown, unfortunately [EnumMember(Value = null)] does not have the intended effect - instead it falls back to a .ToString() representation of the enum ("Unknown"), which the Notion API does not recognize.

The only way to work around this currently, is to actually provide the correct color for the select option, which is not ideal as you may not necessarily know what that is (and it has to match).

(The error about the name field appears to be a mistake, as it goes away if you provide an allowed color.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0