Skip to content

Commit b0954bf

Browse files
authored
fix: add after/limit pagination query params for listUserGroups (OKTA-1273404) (#1711)
* fix: add after/limit pagination query params for listUserGroups (OKTA-1273404) The listUserGroups operation had no query parameters at all, so the SDK could never page through a user's groups even though the real Users API supports pagination via after/limit, matching the pattern already used by the analogous listGroupUsers operation. Adds the after (via queryAfter component) and limit query parameters to the listUserGroups operation. Co-Authored-By: Claude Code * fix: generate backward-compatible overloads when new optional query params are added Adding a new optional query parameter to an already-shipped operation (e.g. OKTA-1273483's getDevice expand, OKTA-1273404's listUserGroups after/limit) changes the arity of the generated method, which silently breaks any existing caller using the old, shorter signature -- a compile-time break for real SDK consumers, confirmed via CI as a runtime MissingMethodException in the Groovy integration tests. Extends the custom api.mustache template to additionally emit a required-params-only overload (plus its additionalHeaders variant, and Paged equivalents) whenever an operation has optional params, delegating to the full-arity method with null for the omitted optional params. This restores the previously-shipped signature for any operation whose required-only shape was the prior public surface, with no impact on operations that have no optional params. Note: this does not preserve every historically-shipped arity in general (e.g. adding a param to an operation that already had other optional params, like listDevices/fields in OKTA-1277564, still changes that operation's full-arity signature) -- only the required-only shape is guaranteed stable. Co-Authored-By: Claude Code * fix: scope compatibility overloads to x-preserve-compat ops, fix javadoc The blanket hasOptionalParams-gated compatibility overloads broke an unrelated operation (getApplication) with a compile error: an ambiguous null passed to two overloads of the same arity (getApplication(String,String) vs the new getApplication(String,Map)). This happens whenever an operation has exactly one optional param. Scope the new overloads to only operations explicitly opted in via the x-preserve-compat vendor extension, and set that extension only on listUserGroups (the operation this branch's fix touches) so unrelated operations across the spec are unaffected. Also fix invalid Javadoc: the compatibility overloads' @PARAM tags referenced the omitted optional parameters, which don't exist on the overload's actual signature -- javadoc's doclint correctly rejected this as "@PARAM name not found", breaking `mvn install`. Replaced with a prose mention of the omitted params and @PARAM tags for the actual (required) parameters instead. Co-Authored-By: Claude Code
1 parent 70dc747 commit b0954bf

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

‎api/src/main/resources/custom_templates/api.mustache‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,43 @@ import org.openapitools.jackson.nullable.JsonNullableModule;
223223
);
224224
}
225225

226+
{{#vendorExtensions.x-preserve-compat}}
227+
/**
228+
* {{summary}} (compatibility overload)
229+
* {{notes}}
230+
*
231+
* Convenience overload that omits these optional parameters, which are sent unset: {{#optionalParams}}{{paramName}}{{^-last}}, {{/-last}}{{/optionalParams}}. Use the overload that accepts all parameters to set them.
232+
{{#requiredParams}}
233+
* @param {{paramName}} {{description}} (required)
234+
{{/requiredParams}}
235+
{{#returnType}}
236+
* @return {{returnType}}
237+
{{/returnType}}
238+
* @throws ApiException if fails to make API call
239+
*/
240+
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) throws ApiException {
241+
{{#returnType}}return {{/returnType}}this.{{operationId}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}null{{/required}}, {{/allParams}}Collections.emptyMap());
242+
}
243+
244+
/**
245+
* {{summary}} (compatibility overload)
246+
* {{notes}}
247+
*
248+
* Convenience overload that omits these optional parameters, which are sent unset: {{#optionalParams}}{{paramName}}{{^-last}}, {{/-last}}{{/optionalParams}}. Use the overload that accepts all parameters to set them.
249+
{{#requiredParams}}
250+
* @param {{paramName}} {{description}} (required)
251+
{{/requiredParams}}
252+
* @param additionalHeaders additionalHeaders for this call
253+
{{#returnType}}
254+
* @return {{returnType}}
255+
{{/returnType}}
256+
* @throws ApiException if fails to make API call
257+
*/
258+
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}, {{/requiredParams}}Map<String, String> additionalHeaders) throws ApiException {
259+
{{#returnType}}return {{/returnType}}this.{{operationId}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}null{{/required}}, {{/allParams}}additionalHeaders);
260+
}
261+
{{/vendorExtensions.x-preserve-compat}}
262+
226263
{{#returnType}}
227264
{{#isArray}}
228265

@@ -334,6 +371,37 @@ import org.openapitools.jackson.nullable.JsonNullableModule;
334371
}
335372
});
336373
}
374+
375+
{{#vendorExtensions.x-preserve-compat}}
376+
/**
377+
* {{summary}} (Paginated, compatibility overload)
378+
* {{notes}}
379+
*
380+
* Convenience overload that omits these optional parameters, which are sent unset: {{#optionalParams}}{{paramName}}{{^-last}}, {{/-last}}{{/optionalParams}}. Use the overload that accepts all parameters to set them.
381+
{{#requiredParams}}
382+
* @param {{paramName}} {{description}} (required)
383+
{{/requiredParams}}
384+
* @return Iterable&lt;{{returnBaseType}}&gt; lazy iterable over all pages
385+
*/
386+
public Iterable<{{{returnBaseType}}}> {{operationId}}Paged({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) {
387+
return this.{{operationId}}Paged({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}null{{/required}}, {{/allParams}}Collections.emptyMap());
388+
}
389+
390+
/**
391+
* {{summary}} (Paginated with additional headers, compatibility overload)
392+
* {{notes}}
393+
*
394+
* Convenience overload that omits these optional parameters, which are sent unset: {{#optionalParams}}{{paramName}}{{^-last}}, {{/-last}}{{/optionalParams}}. Use the overload that accepts all parameters to set them.
395+
{{#requiredParams}}
396+
* @param {{paramName}} {{description}} (required)
397+
{{/requiredParams}}
398+
* @param additionalHeaders additional headers for this call
399+
* @return Iterable&lt;{{returnBaseType}}&gt; lazy iterable over all pages
400+
*/
401+
public Iterable<{{{returnBaseType}}}> {{operationId}}Paged({{#requiredParams}}{{{dataType}}} {{paramName}}, {{/requiredParams}}Map<String, String> additionalHeaders) {
402+
return this.{{operationId}}Paged({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}null{{/required}}, {{/allParams}}additionalHeaders);
403+
}
404+
{{/vendorExtensions.x-preserve-compat}}
337405
{{/isArray}}
338406
{{/returnType}}
339407

‎src/swagger/api.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24079,6 +24079,15 @@ paths:
2407924079
Lists all groups of which the user is a member.
2408024080
> **Note:** To list all groups in your org, use the [List all groups endpoints in the Groups API](/openapi/okta-management/management/tag/Group/#tag/Group/operation/listGroups).
2408124081
operationId: listUserGroups
24082+
x-preserve-compat: true
24083+
parameters:
24084+
- $ref: '#/components/parameters/queryAfter'
24085+
- name: limit
24086+
in: query
24087+
description: Specifies the number of group results in a page
24088+
schema:
24089+
type: integer
24090+
format: int32
2408224091
responses:
2408324092
'200':
2408424093
description: Success

0 commit comments

Comments
 (0)