Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions apps/api-client-go/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9565,8 +9565,7 @@ components:
- member
type: string
assignedRoleIds:
default:
- 00000000-0000-0000-0000-000000000001
default: []

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether generated client defaults/serialization align with OpenAPI default: []

set -euo pipefail

echo "Checking UpdateOrganizationMemberAccess defaults + serialization"
rg -n -A12 -B3 'func NewUpdateOrganizationMemberAccessWithDefaults\(\)' apps/api-client-go/model_update_organization_member_access.go
rg -n -A12 -B3 'func \(o UpdateOrganizationMemberAccess\) ToMap\(\)' apps/api-client-go/model_update_organization_member_access.go

echo "Checking CreateOrganizationInvitation defaults + serialization"
rg -n -A12 -B3 'func NewCreateOrganizationInvitationWithDefaults\(\)' apps/api-client-go/model_create_organization_invitation.go
rg -n -A12 -B3 'func \(o CreateOrganizationInvitation\) ToMap\(\)' apps/api-client-go/model_create_organization_invitation.go

echo "Checking required-property validation on assignedRoleIds"
rg -n -A10 -B2 'requiredProperties := \[]string\{' apps/api-client-go/model_create_organization_invitation.go

Repository: boxlite-ai/boxlite

Length of output: 2912


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "OpenAPI context around 9568/9598"
sed -n '9545,9615p' apps/api-client-go/api/openapi.yaml

echo "Inspect UpdateOrganizationMemberAccess struct fields + AssignedRoleIds type"
rg -n "type UpdateOrganizationMemberAccess struct" -n apps/api-client-go/model_update_organization_member_access.go
rg -n "AssignedRoleIds" apps/api-client-go/model_update_organization_member_access.go | head -n 50
sed -n '1,140p' apps/api-client-go/model_update_organization_member_access.go

echo "Inspect CreateOrganizationInvitation struct fields + AssignedRoleIds type"
rg -n "type CreateOrganizationInvitation struct" -n apps/api-client-go/model_create_organization_invitation.go
rg -n "AssignedRoleIds" apps/api-client-go/model_create_organization_invitation.go | head -n 80
sed -n '1,230p' apps/api-client-go/model_create_organization_invitation.go

echo "Find how ToMap() output is used/JSON marshaled in request bodies"
rg -n "ToMap\(\)" apps/api-client-go | rg -n "UpdateOrganizationMemberAccess|CreateOrganizationInvitation" | head -n 80
rg -n "UpdateOrganizationMemberAccessWithDefaults|CreateOrganizationInvitationWithDefaults" apps/api-client-go | head -n 80

# Also check whether request code uses json.Marshal(ToMap) or something that could transform nil->[].
rg -n "json\.Marshal\(.*ToMap\(\)" apps/api-client-go | head -n 80
rg -n "ToMap\(\).*json" apps/api-client-go | head -n 80

Repository: boxlite-ai/boxlite

Length of output: 14920


OpenAPI default [] for assignedRoleIds isn’t applied by the Go client defaults

UpdateOrganizationMemberAccess.assignedRoleIds and CreateOrganizationInvitation.assignedRoleIds are required and set to default: [] in apps/api-client-go/api/openapi.yaml, but both NewUpdateOrganizationMemberAccessWithDefaults() and NewCreateOrganizationInvitationWithDefaults() only set Role and leave AssignedRoleIds as the Go zero value (nil slice). Since ToMap()/MarshalJSON() always serializes assignedRoleIds from AssignedRoleIds, requests built from these defaults can send assignedRoleIds: null instead of [], creating a schema/contract mismatch.

Also applies to: 9598-9598

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api-client-go/api/openapi.yaml` at line 9568, Constructors
NewUpdateOrganizationMemberAccessWithDefaults and
NewCreateOrganizationInvitationWithDefaults leave AssignedRoleIds as nil which
causes ToMap()/MarshalJSON() to emit null instead of the OpenAPI default [];
update these constructors (and any similar factory funcs referenced around the
other occurrence) to initialize AssignedRoleIds to an empty slice (e.g.,
make([]Type, 0)) so the generated ToMap()/MarshalJSON() serializes
assignedRoleIds as [] and matches the OpenAPI default; reference
AssignedRoleIds, NewUpdateOrganizationMemberAccessWithDefaults,
NewCreateOrganizationInvitationWithDefaults, and ToMap()/MarshalJSON() when
making the change.

description: Array of assigned role IDs
items:
type: string
Expand Down Expand Up @@ -9596,8 +9595,7 @@ components:
- member
type: string
assignedRoleIds:
default:
- 00000000-0000-0000-0000-000000000001
default: []
description: Array of assigned role IDs for the invitee
items:
type: string
Expand Down
5 changes: 5 additions & 0 deletions apps/otel-collector/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ ENV PATH="/usr/local/go/bin:${PATH}"

RUN apk add --no-cache git

# Native add-ons in the yarn workspace (e.g. cpu-features) need a
# C/C++ toolchain + python3 to compile during `yarn install`. Alpine
# base image doesn't ship these by default.
RUN apk add --no-cache python3 make g++

WORKDIR /boxlite

# Yarn caching layer
Expand Down
6 changes: 3 additions & 3 deletions apps/otel-collector/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dist:
exporters:
- gomod: github.com/boxlite-ai/otel-collector/exporter v0.0.1
name: boxliteexporter
path: otel-collector/exporter
path: apps/otel-collector/exporter
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/clickhouseexporter v0.144.0
name: clickhouse

Expand All @@ -22,5 +22,5 @@ extensions:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension v0.144.0

replaces:
- github.com/boxlite-ai/boxlite/libs/api-client-go => ../../../api-client-go
- github.com/boxlite-ai/common-go => ../../../common-go
- github.com/boxlite-ai/boxlite/libs/api-client-go => ../../../apps/api-client-go
- github.com/boxlite-ai/common-go => ../../../apps/common-go
Loading