File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -245,11 +245,14 @@ type UnifiedPaginationParams struct {
245245
246246// ToGraphQLParams converts REST API pagination parameters to GraphQL-specific parameters.
247247// This converts page/perPage to first parameter for GraphQL queries.
248- func (u UnifiedPaginationParams ) ToGraphQLParams () GraphQLPaginationParams {
248+ func (u UnifiedPaginationParams ) ToGraphQLParams () (GraphQLPaginationParams , error ) {
249+ if u .PerPage > 100 {
250+ return GraphQLPaginationParams {}, fmt .Errorf ("perPage value %d exceeds maximum of 100" , u .PerPage )
251+ }
249252 first := int32 (u .PerPage )
250253 return GraphQLPaginationParams {
251- First : & first , //nolint:gosec // G115: This is safe, we cap perPage to 100 in the toolset
252- }
254+ First : & first ,
255+ }, nil
253256}
254257
255258// OptionalUnifiedPaginationParams returns pagination parameters from the request.
You can’t perform that action at this time.
0 commit comments