From dd32e3e4964531275e042769c479719fd81f94e5 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 3 Jun 2026 20:19:58 +0200 Subject: [PATCH] fix(api/v2): keep include_public out of the team body schema include_public is a list-time query flag, not a team field. With json:"include_public" it leaked into the v2 Team request/response body schema (POST/PUT). Mark it json:"-" so it only travels as a query parameter: v1 binds it via the query tag, and the v2 list handler takes it as a dedicated query field and sets it on the model internally. --- pkg/models/teams.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/models/teams.go b/pkg/models/teams.go index 3ab9e6cd0..f336640aa 100644 --- a/pkg/models/teams.go +++ b/pkg/models/teams.go @@ -57,8 +57,11 @@ type Team struct { // Defines wether the team should be publicly discoverable when sharing a project IsPublic bool `xorm:"not null default false" json:"is_public" doc:"Whether the team should be publicly discoverable when sharing a project. Only effective if public teams are enabled on the instance."` - // Query parameter controlling whether to include public projects or not - IncludePublic bool `xorm:"-" query:"include_public" json:"include_public" doc:"When listing teams, also include public teams the user is not a member of. Only honored when public teams are enabled on the instance."` + // Query-only flag controlling whether public teams the user is not a member + // of are included when listing. It is never part of the request or response + // body (json:"-") — v1 binds it from the query string via the query tag, and + // the v2 list handler takes it as a dedicated query field and sets it here. + IncludePublic bool `xorm:"-" query:"include_public" json:"-"` web.CRUDable `xorm:"-" json:"-"` web.Permissions `xorm:"-" json:"-"`