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 {
245
245
246
246
// ToGraphQLParams converts REST API pagination parameters to GraphQL-specific parameters.
247
247
// 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
+ }
249
252
first := int32 (u .PerPage )
250
253
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
253
256
}
254
257
255
258
// OptionalUnifiedPaginationParams returns pagination parameters from the request.
You can’t perform that action at this time.
0 commit comments