Skip to content

[Go] Compilation errors for NOTION.COM api #7808

Description

@WolfgangHG

Found as part of #7774:

Using the source code from 2026-06-17 and this command:

.\it\generate-code.ps1 -descriptionUrl https://developers.notion.com/openapi.json  -language "go" -dev
.\it\exec-cmd.ps1 -descriptionUrl https://developers.notion.com/openapi.json  -language "go"

The generated client does not compile:

# integrationtest/client/models
client\models\group_by_config_request.go:80:27: cannot use val (variable of type interface{}) as *GroupByConfigRequest_group_by value in argument to result.SetGroupBy: need type assertion
client\models\group_by_config_request.go:85:31: cannot use val (variable of type interface{}) as *GroupByConfigRequest_type value in argument to result.SetTypeEscaped: need type assertion
client\models\group_by_config_response.go:82:27: cannot use val (variable of type interface{}) as *GroupByConfigResponse_group_by value in argument to result.SetGroupBy: need type assertion
client\models\group_by_config_response.go:87:31: cannot use val (variable of type interface{}) as *GroupByConfigResponse_type value in argument to result.SetTypeEscaped: need type assertion
# integrationtest/client/models
client\models\group_by_config_request.go:80:27: cannot use val (variable of type interface{}) as *GroupByConfigRequest_group_by value in argument to result.SetGroupBy: need type assertion
client\models\group_by_config_request.go:85:31: cannot use val (variable of type interface{}) as *GroupByConfigRequest_type value in argument to result.SetTypeEscaped: need type assertion
client\models\group_by_config_response.go:82:27: cannot use val (variable of type interface{}) as *GroupByConfigResponse_group_by value in argument to result.SetGroupBy: need type assertion
client\models\group_by_config_response.go:87:31: cannot use val (variable of type interface{}) as *GroupByConfigResponse_type value in argument to result.SetTypeEscaped: need type assertion

The relevant code snippet:

// GroupByConfigRequest group-by configuration based on property type.
type GroupByConfigRequest struct {
    ...
    // How to group status values. "group" groups by status group (To Do/In Progress/Done), "option" groups by individual option.
    group_by *GroupByConfigRequest_group_by
    // Whether to hide groups that have no items.
    hide_empty_groups *bool
    ...
    // The property type for grouping.
    typeEscaped *GroupByConfigRequest_type
}
...

func CreateGroupByConfigRequestFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
    result := NewGroupByConfigRequest()
    if parseNode != nil {
        mappingValueNode, err := parseNode.GetChildNode("")
        if err != nil {
            return nil, err
        }
        if mappingValueNode != nil {
            mappingValue, err := mappingValueNode.GetStringValue()
            if err != nil {
                return nil, err
            }
            if mappingValue != nil {
            }
        }
    }
    if val, err := parseNode.GetEnumValue(ParseGroupByConfigRequest_group_by); val != nil {
        if err != nil {
            return nil, err
        }
        result.SetGroupBy(val)
    } else if val, err := parseNode.GetEnumValue(ParseGroupByConfigRequest_type); val != nil {
        if err != nil {
            return nil, err
        }
        result.SetTypeEscaped(val)

This is the json snippet the generates this class:

"groupByConfigRequest": {
  "oneOf": [
    {
      "$ref": "#/components/schemas/selectGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/statusGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/personGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/relationGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/dateGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/textGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/numberGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/checkboxGroupByConfigRequest"
    },
    {
      "$ref": "#/components/schemas/formulaGroupByConfigRequest"
    }
  ],
  "description": "Group-by configuration based on property type."
},

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions