From 1599be4758361026bbbeca76be4a5c29ef38e2cd Mon Sep 17 00:00:00 2001 From: appscisumup Date: Thu, 24 Sep 2026 23:18:34 +0000 Subject: [PATCH 1/3] chore: synced local 'openapi.json' with remote 'specs/openapi31.json' --- openapi.json | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/openapi.json b/openapi.json index 0c914234..8f2f6618 100644 --- a/openapi.json +++ b/openapi.json @@ -3454,27 +3454,19 @@ { "name": "resource.parent.id", "in": "query", - "description": "Filter memberships by the parent of the resource the membership is in.\nWhen filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null to filter for resources without a parent.", + "allowEmptyValue": true, + "description": "Filter memberships by the parent of the resource the membership is in.\nOmit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, both parameters must be present. To select resources without a parent, set each parameter to an empty value. Otherwise, both parameters must identify a parent.", "schema": { - "type": [ - "string", - "null" - ] + "type": "string" } }, { "name": "resource.parent.type", "in": "query", - "description": "Filter memberships by the parent of the resource the membership is in.\nWhen filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null to filter for resources without a parent.", + "allowEmptyValue": true, + "description": "Filter memberships by the parent of the resource the membership is in.\nOmit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, both parameters must be present. To select resources without a parent, set each parameter to an empty value. Otherwise, both parameters must identify a parent.", "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/ResourceType" - }, - { - "type": "null" - } - ] + "$ref": "#/components/schemas/ResourceType" } }, { From db464c730958bfda210d5850007a7cb633ddb220 Mon Sep 17 00:00:00 2001 From: "sumup-release-bot[bot]" <241716704+sumup-release-bot[bot]@users.noreply.github.com> Date: Thu, 24 Sep 2026 23:20:04 +0000 Subject: [PATCH 2/3] chore: generate code --- DOCUMENTATION.md | 32 +++++++++++++++++--------------- memberships.go | 27 ++++++++++----------------- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 26b58622..e08d19f8 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -3109,7 +3109,7 @@ type MembersUpdateParamsUser struct { ``` -## type [Membership]() +## type [Membership]() A membership associates a user with a resource, memberships is defined by user, resource, resource type, and associated roles. @@ -3150,7 +3150,7 @@ type Membership struct { ``` -## type [MembershipResource]() +## type [MembershipResource]() Information about the resource the membership is in. @@ -3249,7 +3249,7 @@ type MembershipUserClassic struct { ``` -## type [MembershipsClient]() +## type [MembershipsClient]() MembershipsClient provides access to the Memberships API. @@ -3262,7 +3262,7 @@ type MembershipsClient struct { ``` -### func [NewMembershipsClient]() +### func [NewMembershipsClient]() ```go func NewMembershipsClient(c *client.Client) *MembershipsClient @@ -3271,7 +3271,7 @@ func NewMembershipsClient(c *client.Client) *MembershipsClient -### func \(\*MembershipsClient\) [List]() +### func \(\*MembershipsClient\) [List]() ```go func (c *MembershipsClient) List(ctx context.Context, params MembershipsListParams) (*MembershipsListResponse, error) @@ -3280,7 +3280,7 @@ func (c *MembershipsClient) List(ctx context.Context, params MembershipsListPara List memberships of the current user. -## type [MembershipsListParams]() +## type [MembershipsListParams]() MembershipsListParams are query parameters for ListMemberships. @@ -3299,13 +3299,15 @@ type MembershipsListParams struct { // Filter memberships by the name of the resource the membership is in. ResourceName *string // Filter memberships by the parent of the resource the membership is in. - // When filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null - // to filter for resources without a parent. - ResourceParentID *nullable.Field[string] + // Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, + // both parameters must be present. To select resources without a parent, set each parameter to an empty value. + // Otherwise, both parameters must identify a parent. + ResourceParentID *string // Filter memberships by the parent of the resource the membership is in. - // When filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null - // to filter for resources without a parent. - ResourceParentType *nullable.Field[ResourceType] + // Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, + // both parameters must be present. To select resources without a parent, set each parameter to an empty value. + // Otherwise, both parameters must identify a parent. + ResourceParentType *ResourceType // Filter memberships by resource kind. ResourceType *ResourceType // Filter the returned memberships by role. @@ -3316,7 +3318,7 @@ type MembershipsListParams struct { ``` -### func \(\*MembershipsListParams\) [QueryValues]() +### func \(\*MembershipsListParams\) [QueryValues]() ```go func (p *MembershipsListParams) QueryValues() url.Values @@ -3325,7 +3327,7 @@ func (p *MembershipsListParams) QueryValues() url.Values QueryValues converts [MembershipsListParams](<#MembershipsListParams>) into \[url.Values\]. -## type [MembershipsListResponse]() +## type [MembershipsListResponse]() MembershipsListResponse is a schema definition. @@ -4816,7 +4818,7 @@ func (p *ReceiptsGetParams) QueryValues() url.Values QueryValues converts [ReceiptsGetParams](<#ReceiptsGetParams>) into \[url.Values\]. -## type [ResourceType]() +## type [ResourceType]() The type of the membership resource. Possible values are: \* \`merchant\` \- merchant account\(s\) \* \`organization\` \- organization\(s\) diff --git a/memberships.go b/memberships.go index a191dbb1..55ccd8e0 100755 --- a/memberships.go +++ b/memberships.go @@ -12,7 +12,6 @@ import ( "time" "github.com/sumup/sumup-go/client" - "github.com/sumup/sumup-go/nullable" ) // A membership associates a user with a resource, memberships is defined by user, resource, resource type, and @@ -95,13 +94,15 @@ type MembershipsListParams struct { // Filter memberships by the name of the resource the membership is in. ResourceName *string // Filter memberships by the parent of the resource the membership is in. - // When filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null - // to filter for resources without a parent. - ResourceParentID *nullable.Field[string] + // Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, + // both parameters must be present. To select resources without a parent, set each parameter to an empty value. + // Otherwise, both parameters must identify a parent. + ResourceParentID *string // Filter memberships by the parent of the resource the membership is in. - // When filtering by parent both `resource.parent.id` and `resource.parent.type` must be present. Pass explicit null - // to filter for resources without a parent. - ResourceParentType *nullable.Field[ResourceType] + // Omit both `resource.parent.id` and `resource.parent.type` to skip parent filtering. When filtering by parent, + // both parameters must be present. To select resources without a parent, set each parameter to an empty value. + // Otherwise, both parameters must identify a parent. + ResourceParentType *ResourceType // Filter memberships by resource kind. ResourceType *ResourceType // Filter the returned memberships by role. @@ -139,19 +140,11 @@ func (p *MembershipsListParams) QueryValues() url.Values { } if p.ResourceParentID != nil { - if p.ResourceParentID.Null() { - q.Set("resource.parent.id", "null") - } else { - q.Set("resource.parent.id", *p.ResourceParentID.Value()) - } + q.Set("resource.parent.id", *p.ResourceParentID) } if p.ResourceParentType != nil { - if p.ResourceParentType.Null() { - q.Set("resource.parent.type", "null") - } else { - q.Set("resource.parent.type", string(*p.ResourceParentType.Value())) - } + q.Set("resource.parent.type", string(*p.ResourceParentType)) } if p.ResourceType != nil { From 9cb5b70b002e7a74b140a94c6a8e275f58b1e3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Fri, 25 Sep 2026 10:42:22 +0200 Subject: [PATCH 3/3] chore: cleanup param handling --- internal/cmd/codegen/pkg/builder/transform.go | 4 ---- internal/cmd/codegen/pkg/builder/types.go | 22 +------------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/internal/cmd/codegen/pkg/builder/transform.go b/internal/cmd/codegen/pkg/builder/transform.go index f418aa56..0939d40a 100644 --- a/internal/cmd/codegen/pkg/builder/transform.go +++ b/internal/cmd/codegen/pkg/builder/transform.go @@ -174,10 +174,6 @@ func (b *Builder) pathsToParamTypes(tagName string, paths *v3.Paths) []Writable optional := param.Required == nil || !*param.Required pointer := shouldUsePointer(optional, param.Schema, typ) - if isNullableSchema(param.Schema) { - typ = "nullable.Field[" + typ + "]" - pointer = optional - } fields = append(fields, StructField{ Name: name, Type: typ, diff --git a/internal/cmd/codegen/pkg/builder/types.go b/internal/cmd/codegen/pkg/builder/types.go index 9ad5877c..34ca919a 100644 --- a/internal/cmd/codegen/pkg/builder/types.go +++ b/internal/cmd/codegen/pkg/builder/types.go @@ -276,27 +276,7 @@ func (e toQueryValues) String() string { fmt.Fprintf(buf, "\tq := make(url.Values)\n\n") for _, f := range e.Typ.Fields { name := strcase.ToCamel(f.Name) - if isNullableSchema(f.Parameter.Schema) { - field := fmt.Sprintf("p.%s", name) - if f.Pointer { - fmt.Fprintf(buf, "\tif %s != nil {\n", field) - } - fmt.Fprintf(buf, "\tif %s.Null() {\n", field) - fmt.Fprintf(buf, "\t\tq.Set(%q, %q)\n", f.Name, "null") - fmt.Fprint(buf, "\t} else {\n") - schema := dereferenceSchema(f.Parameter.Schema) - if schema != nil && schema.Schema() != nil && isArraySchema(schema.Schema()) { - fmt.Fprintf(buf, "\t\tfor _, v := range *%s.Value() {\n", field) - fmt.Fprintf(buf, "\t\t\tq.Add(%q, %s)\n", f.Name, schemaToString("v", schema.Schema().Items.A)) - fmt.Fprint(buf, "\t\t}\n") - } else { - fmt.Fprintf(buf, "\t\tq.Set(%q, %s)\n", f.Name, paramToString("*"+field+".Value()", f.Parameter)) - } - fmt.Fprint(buf, "\t}\n") - if f.Pointer { - fmt.Fprint(buf, "\t}\n") - } - } else if f.Parameter.Schema != nil && f.Parameter.Schema.Schema() != nil && slices.Contains(f.Parameter.Schema.Schema().Type, "array") { + if f.Parameter.Schema != nil && f.Parameter.Schema.Schema() != nil && slices.Contains(f.Parameter.Schema.Schema().Type, "array") { field := fmt.Sprintf("p.%s", name) fmt.Fprintf(buf, "\tfor _, v := range %s {\n", field) fmt.Fprintf(buf, "\t\tq.Add(%q, %s)\n", f.Name, paramToString("v", f.Parameter))