[Go] Compilation errors for NOTION.COM api
- Dominant language
- C#
- Stars
- 3.8k
- Forks
- 333
- Avg merge
- 16h 29m
- Merged PRs (30d)
- 116
Description
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:
```golang
// 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:
```json
"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."
},
```
Contributor guide
Research direction
Run it\generate-code.ps1 and it\exec-cmd.ps1 with the Notion OpenAPI URL and Go language, then inspect the generated client\models\group_by_config_request.go and group_by_config_response.go files. Trace how the groupByConfigRequest oneOf schema is handled and verify that the generated Go client compiles without the reported type errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100