MortenGregersen/Bagbutik

Illegal Parameter "limit"

Closed this issue · 1 comments

Environment
Bagbutik Version: 10.3.0
Platform: macOS Sonoma 14.5

Details
I'm making the following request to get data related to an experiment. I noticed that if I make the request without the limit parameter, I only get 10 localizations (in a random order). This isn't great for apps that have many localizations in the experiment.

let treatmentID = treatmentRelationship.id
let response = try await service.request(
    .getAppStoreVersionExperimentTreatmentV1(
        id: treatmentID,
        includes: [.appStoreVersionExperimentTreatmentLocalizations],
        limit: 50
    )
)

When I make the request, I get the following error:

badRequest(Bagbutik_Core.ErrorResponse(errors: Optional([Bagbutik_Core.ErrorResponse.Errors(code: "PARAMETER_ERROR.ILLEGAL", detail: Optional("The parameter 'limit' can not be used with this request"), id: Optional("020add9f-38c7-41c8-a69c-9e8fba508db0"), meta: nil, source: Optional(Bagbutik_Core.ErrorResponse.Errors.Source.jsonPointer(Bagbutik_Core.JsonPointer(pointer: nil))), status: "400", title: "A given parameter is not allowed for this request")])))

Is something misaligned in the spec? Or is this a bug in the ASC API?

Okay, looking at the documentation for this endpoint, it looks like the response is correct. The only limit parameter that can be given to the request is limit[appStoreVersionExperimentTreatmentLocalizations].

Looking at the spec, it seems correct also:

{
  "name" : "limit[appStoreVersionExperimentTreatmentLocalizations]",
  "in" : "query",
  "description" : "maximum number of related appStoreVersionExperimentTreatmentLocalizations returned (when they are included)",
  "schema" : {
    "type" : "integer",
    "maximum" : 50
  },
  "style" : "form",
  "required" : false
}

So there must be something wrong with how we decode this in BagbutikSpecDecoder or how we generate it afterwards. I will look into it.